1

I cannot get ajax to work in IE10. No matter how many times/ways/frameworks I try, nothing works. It always returns an empty string.

<html>
<head>
    <script type="text/javascript" src="jquery-1-9-1.js"></script>
</head>
<body>
<br/>
<a onclick="doit()">go</a>
<script>
    function doit()
    {
    var myData = { "key": "value" };
    $.ajax({
        url: "myhandlepage.php",
        data: myData,
        dataType: 'json',
        type: 'POST',
        contentType: 'application/x-www-form-urlencoded',
        success: function (data) { alert("OK = " + data.eric); },
        error: function (data, status) { alert("FAILED:" + status); }
    });
    }
</script>
</body>
</html>
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330

2 Answers2

1

Possible answer: http://bugs.jquery.com/ticket/12790#comment:28

It appears to be an issue with IE10 and POST requests. So there may not be a fix for this at all. It means if people start using IE10, there will be a LOT of broken ajax sites!

This appears to be a widespread problem with POST requests on IE10, one that we do not control, so there is no need to post further feedback in this ticket. Here is the Microsoft ticket for the problem; note that you will need to create a login to view:

http://connect.microsoft.com/IE/feedback/details/771016

Community
  • 1
  • 1
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
1

UPDATE (2/27/13):

Microsoft has released the final version of IE 10 for Win 7. Update includes important fixes: Internet Explorer 10 Arrives on Windows 7


Could be the data you are sending in. Try the revisions below and you can leave off contentType:

function doit()
{
var myData = { key: "value" }; //plain object
$.ajax({
    url: "myhandlepage.php",
    data: myData,
    dataType: 'json',
    type: 'POST',
    success: function (data) { alert("OK = " + data.eric); },
    error: function (data, status) { alert("FAILED:" + status); }
});
}

From the jquery docs:

contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8')

Also, clarify the operating system and IE10 version.

From the bug report:

This is only an issue on the desktop in Windows 7. IE10 in Windows 8 is working correctly.

jk.
  • 14,365
  • 4
  • 43
  • 58
  • no, adding that doesn't fix it. – Don Rhummy Feb 12 '13 at 01:02
  • What OS version are you using, Win 7 or 8? – jk. Feb 12 '13 at 01:03
  • @DonRhummy That's probably the issue then. You can try what solved it for Win 7 in this question: http://stackoverflow.com/questions/13101729/jquery-ajax-call-works-in-all-browser-except-ie-10?rq=1 – jk. Feb 12 '13 at 01:16
  • no, that's not the issue. I do not have any addons. That person had an addon. Please read this: http://bugs.jquery.com/ticket/12790#comment:28 – Don Rhummy Feb 12 '13 at 01:20
  • @DonRhummy I read it but I'm not creating an account with MS. I have too many already. Good chance you won't have this issue with Win 8. Until MS fixes it for Win 7, it won't work. – jk. Feb 12 '13 at 01:22
  • @DonRhummy Microsoft just released an update for IE 10 on Win 7. This may fix your issue: [Internet Explorer 10 Arrives on Windows 7](http://www.webmonkey.com/2013/02/internet-explorer-10-arrives-on-windows-7/) – jk. Feb 27 '13 at 14:29
  • @DonRhummy Did an update for IE 10 on Windows 7 mentioned by jk above fix the problem? – Piotr Dobrogost Oct 17 '13 at 10:16
  • @PiotrDobrogost I'm not sure, I'll have to check that out. – Don Rhummy Oct 17 '13 at 17:16