jQuery Ajax does not work in IE8 and IE9

3

I'm using Internet Explorer 9 for testing and ajax requests do not work (in all other browsers they work).

I have this code:

$.ajax({
    type: "GET",
    url: "http://cep.correiocontrol.com.br/60441145.json",
    dataType: "json",
    success: function(data) { 
        alert('sucess');
    },
    error: function (request, status, errorThrown) {
        alert(errorThrown);
    } 
});

IE returns "NO TRANSPORT". I researched in forums and saw that the solution was to put above the script:

jQuery.support.cors = true;

I added but in IE now it returns "OBJECT ERROR". Has anyone gone through this?

    
asked by anonymous 16.04.2014 / 23:07

1 answer

4

You are trying to use CORS, which is a method to allow access to another domain via Ajax. IE only came to support this in the standard way from version 10, and jQuery does not support CORS for IE8 and IE9. You can use a plugin to enable this support, such as this here .

Source: English Answer in SO .

    
16.04.2014 / 23:30