Fred Sullet
Fred Sullet

Reputation: 371

Submit a "pure" HTTP request from HTML page

I need to send the following HTTP request to my REST server from an HTML page to retrieve another page. How to do that using javascript or forms or links or whatever ?

Note that the HTTP request body must contain plain text with no key/value pairs as a form usually does.

PUT /somerequest HTTP/1.1
Host: www.myhost.com
Accept: text/html,application/xhtml+xml

Payload of the request to be read by the server script.
The script will return a HTML content to my browser.
Thanks !

Upvotes: 1

Views: 4553

Answers (1)

Maresh
Maresh

Reputation: 4712

You could use jQuery?

http://api.jquery.com/jQuery.ajax/

I'm sure you will find what you want there.

And if you don't look at a lower layer: XMLHttpRequest

http://www.w3.org/TR/XMLHttpRequest/

Upvotes: 1

Related Questions