Internet Explorer 10 not sent Ajax Post Data

Well, I researched this for several hours, and I'm still at a standstill.

Internet explorer ten will send ajax requests using jquery, but it will not include post data.

Here is the code:

var ajaxData = "FirstName="+encodeURIComponent($('#FirstName').val()); //get the data from the account form ajaxData += "&LastName="+encodeURIComponent($('#LastName').val()); ajaxData += "&EmailAddress="+encodeURIComponent($('#EmailAddress').val()); ajaxData += "&CAT_Custom_246311="+encodeURIComponent(listData); var config = { async: false, type: "POST", url: "/FormProcessv2.aspx?WebFormID=44714&OID={module_oid}&OTYPE={module_otype}&EID={module_eid}&CID={module_cid}&JSON=1", dataType: "json", // text"json", processData: false, data: ajaxData, timeout: 70000, cache: false, }; $.ajax(config) .done(function(data, event) { if(data.FormProcessV2Response.success == true){ //success field is in BC response alert("The list was submitted sucessfully."); console.log(XHR); } else{ alert("An error occurred and the list was not submitted."); } }) .fail(function(msg,event) { alert("An error occurred and the list was not submitted."); }); 

Every other browser (safari, opera, chrome, firefox, IE9) will allow this to work, but the code does not work in IE 10. Looking at it with a violinist, it is shown that the headers are almost the same between other browsers and IE 10, but the IE request headers 10 have a content length value of 0, and there is no body text.

Regarding some of the other problems that people had, no, I don’t have load manager style plugins. All plugins by default. Here is a photo of the plugins that I have for recording.

Plugins

 var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST",config.url,true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(config.data); } 

This is dummy text from w3schools for a raw request with my own data.

Here is an example of the data value that is given by Internet Explorer itself (using dev tools)

 FirstName=Joe&LastName=Spacely&EmailAddress=tester%40test.com&CAT_Custom_246311=test%3Dtest 

I am using Internet Explorer 10.0.9200.16519 for Windows 8 x64 w / Media Pack.

Doesn't Internet Explorer just support it?

Any help would be greatly appreciated. Oh, and please refrain from telling me how bad IE is. We all know this, but we web developers are still dealing with this.

+6
source share
2 answers

Posting on request:

Does this relate to your URL already having $ _POST data? Perhaps if you include this information in your variable and just ask the static URL for more success.

By the way, you can use the {key: value} pairs, since creating a query string is much more difficult to maintain.

+2
source

I had problems with IE and form data before. I found it best to have my input fields wrapped with a form tag with an identifier. Then, when you publish the data, use the jQuery function . Serialize () to build a post data string for you.

So your configuration will look something like this:

 var config = { async: false, type: "POST", url: "/FormProcessv2.aspx", //truncated for simplicity dataType: "json", processData: false, data: $('#formName').serialize(), timeout: 70000, cache: false }; 

Also, just in case, I mentioned to make sure you bind this ajax post to submit the form or click the button, to prevent the default action of submitting the form using event.preventDefault () .

+2
source

All Articles