简体   繁体   中英

IE8: Access denied

I am trying to access and API using jquery/post but its not working in IE8. Its throwing Access denied error in IE8 only.

js code:

var url = 'http://somecomp.cartodb.com:80/api/v1/map?map_key=xxxxxxxxxxxxxxxxxxxx&stat_tag=API';
    var data = //some long data of length greater than 3000
    $.ajax({
        crossOrigin: !0,
        type: "POST",
        method: "POST",
        dataType: "json",
        contentType: "application/json",
        url: url,
        data: JSON.stringify(data),
        success: function(a) {
            console.log('success');
        },
        error: function(a) {
            console.log('error');
        }
    })

If I add ?callback=? at the end of url, it still fires the error callback but with statusText: 'success' and code: 200

here is full code: http://textuploader.com/ato0w

Change dataType to jsonp will allow you to make cross-domiain requests. This will work only with GET requests.

If you're using CORS for accessing cross-origin resource, try to add the following line:

$.ajax({
     crossDomain: true, // replace "crossOrigin: !0;"
});

If this not working for you, try to add the following line above $.ajax() call.

jQuery.support.cors = true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM