xhttp.setrequestheader( content-type application/x-www-form-urlencoded )

 

 

 

 

XMLHTTPREQUEST METHODS. Method getAllResponseHeaders() getResponseHeader() open(method, url, async).xhttp.open("POST", "ajaxtest.php", true) xhttp.setRequestHeader(" Content-type", "application/x-www-form-urlencoded") xhttp.send The application/x-www-form-urlencoded mime type does not support parameters (such as charset). If you look at this section of the HTML5 spec, you will see how charset is determined (its complicated). http.setRequestHeader("Content-type", "application/x-www-form-urlencoded") http.setRequestHeader("Content-length", params.length) http.setRequestHeader("Connection", "close") With the above lines we are basically saying that the data send is in the format of a form http.setRequestHeader("Content-type", "application/x-www-form-urlencoded") http. setRequestHeader("Content-length", params.length) http.setRequestHeader("Connection", "close") With the above lines we are basically saying that the data send is in the format of a form Im not very good at programming, Im trying to make a contact form and send the information with a response in the same page.

function send(str) var xhttp new XMLHttpRequest() xhttp.onreadystatechange function() ifxhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded") xhttp.send By invoking setRequestHeader twice, cookies should properly sentbut that not happeningfalse http.setRequestHeader "X-Requested-With", "XMLHttpRequest" http. setRequestHeader "Content-Type", "application/x-www-form-urlencoded" http. setRequestHeader "Cookie" Note that the URL should be on the same domain as the function caller.xhttp.send() else if (soMethod POST) . xhttp.setRequestHeader( Content-type, application/x-www-form-urlencoded) xDoc New MSXML.

DOMDocument If xDoc.loadXML(sSOAPRequest) Then xHTTP New MSXML.XMLHTTPRequest xHTTP.open("POST", sRequest, False) xHTTP.setRequestHeader("content-type", "application/x-www-form-urlencoded" Whats wrong with my code? Is my setRequestHeader incorrect? getUser(1) function getUser(userId) var usersUrl "http"Content-type", "application/x-www-form-urlencoded") xhttp.send() var response JSON.parse( xhttp.responseText) return response I am trying to send data with ajax like this: xhttp.open("post", "addTeam", true) xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded") xhttp.send("tName" tName) And how can i get it on server, i try to do this like this xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded ") Simply set the content type as application/xml while sending the ajax request. Links to refer - Tryit Editor v3.0 JQuery ajax() get xml responsexhttp.open("POST", "demopost2.asp", true) xhttp.setRequestHeader(" Content-type", "application/x-www-form-urlencoded") xhttp.send xhttp new XMLHttpRequest() xhttp.open("POST", "media.do", true) xhttp .setRequestHeader("Content-Type", "application/x-www-form-urlencoded") xhttp.send("datavalue") this is a struts project, in the action which map to "media.do" xhttp.open("POST", "my-form.php", true) xhttp.setRequestHeader("Content- type", "application/x-www-form-urlencoded") xhttp.send(mydata)?> The form info is sent with no issues, just the xhttp.status is not returning as 200 as it should. var xhttp new XMLHttpRequest() This is the index.html page with the javascript code: