How to Fix No Transport Error with jQuery Ajax call in IE

If you are using cross domain Ajax requests in javascript then it may not run properly on IE 7, 8 or 9. For eg. let the ajax call be similar to this.

$.ajax({
    type: "POST",
    url: 'https://api.foursquare.com/v2/venues/search',
    contentType: "application/json",
    data: JSON.stringify(json),
    crossDomain: true,
    success: function (respData, status, xhr) {
        // success
    },
    error: function (xhr, status, error) {
        //error 
    }
});

The ajax request would work perfectly on Chrome or Firefox but you might get an error while using IE 7, 8 or 9. You might get a No Transport error while using older versions of IE. Simply add the following before the ajax call and cross domain requests will start working.

$.support.cors = true;

Here’s a link to the known bug.

This content has been helpful to you?

Thanks for contributing!

Yes No