Alex Rivera | Logout

Why is IE 10 Refusing to send POST data via jQuery $.ajax

Asked 2012-11-02T02:33:04.820
21

Both in my development and production environment, IE 10 is refusing to send any POST data via a simple $.ajax call.

My script looks like this:

d = 'testvar=something';
$.ajax({
    data: d,
    success: function(h){
        console.log(h);
    }
});

The actual ajax request is going through, but no post data???

The request headers look normal:

Request POST /steps/~do HTTP/1.1
Accept  */*
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With    XMLHttpRequest
Referer http://localhost:8080/steps/
Accept-Language en-GB,en-AU;q=0.7,en;q=0.3
Accept-Encoding gzip, deflate
User-Agent  Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Host    localhost:8080
Content-Length  0
DNT 1
Connection  Keep-Alive
Cache-Control   no-cache

But the request body is empty! (I'm using IE's network tab in their F12 dev bar to capture requests). In the PHP script, print_r($_POST); returns an empty array.

This works fine in IE 7 - 9, chrome, FF and safari, but breaks in IE10?

I'm not sure if I've missed something, or if IE 10 is just buggy?

EDIT

I've set the global ajax settings as follows:

$.ajaxSetup({
    url: ROOT+'~do', // ROOT is either http://localhost/.../~do or http(s)://www.steps.org.au/~do depending on production or development environment
    type: 'POST'
});

Further Edit

Using IE version 10.0.9200.16384 on Windows 8 Pro 64 bit

Direct copy/paste of request headers are:

Key Value
Accept  */*
Accept-Encoding gzip, deflate
Accept-Language en-GB,en-AU;q=0.7,en;q=0.3
Cache-Control   no-cache
Connection  Keep-Alive
Content-Length  0
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
Cookie  __utma=91949528.1947702769.1348201656.1353212510.1353237955.6; __utmz=91949528.1348201656.1.1.utmcsr=localhost|utmc
Edit
Report

2 Answers

4

Sorry, but my all attempts to reproduce your problems were without success. In other words all POSTs were with HTTP body and the Ajax requests worked correctly. So I could not reproduce the problem which you described. I made all tests on Internet Explorer 10, Windows 8 W64 RTM Enterprise with all current windows updates.

If I add some item (for example the first one) to the chat on the page you referenced I can see that POST request the the following header will be produced:

Anforderung       POST /~do HTTP/1.1
Accept            */*
Content-Type      application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With  XMLHttpRequest
Referer           https://www.steps.org.au/
Accept-Language   de-DE,de;q=0.8,ru;q=0.7,en-US;q=0.5,en;q=0.3,ja;q=0.2
Accept-Encoding   gzip, deflate
User-Agent        Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; Touch)
Host              www.steps.org.au
Content-Length    81
DNT               1
Connection        Keep-Alive
Cache-Control     no-cache
Cookie            __utmc=91949528; __utma=91949528.365135675.1353268932.1353268932.1353268932.1; __utmb=91949528.1.10.1353268932; __utmz=91949528.1353268932.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=ka4shsgkfvnvfdcath2klh9un0; cartID=4a90a72a379989f597276ca30c79c6f6

One can see that Content-Length is 81 and it's not 0. The body is

i=1211&q=1&token=00f5e9f5768d09ae67f2016ebcb62e99a0d75345&cmd=addToCart&sideBar=1

The request will be answered with HTML fragment and the button become green.

To be exactly during adding the item to the chat it will be executed another code as you posted in your question. It will be executed the following code (lines 49-74) from answered 2012-11-18T21:12:04.147

2

I also faced same issue, Below changes worked for me.

<meta http-equiv="x-ua-compatible" content="IE=9" >

Worked for me :)

answered 2013-02-28T12:38:46.967

Your Answer