开发者

AJAX command fails strangely but 100% of the time for some users but not most (jQuery)

开发者 https://www.devze.com 2023-03-22 04:43 出处:网络
This is driving me bonkers! Some of the users of my Chrome browser extension are having trouble with an ajax request (it works fine for me and most). The problem happens whenever they try to access t

This is driving me bonkers!

Some of the users of my Chrome browser extension are having trouble with an ajax request (it works fine for me and most). The problem happens whenever they try to access the API provided by my webserver (HTTPS), but not when they try to access other ajax commands. I have confirmed that they can load the URL in a browser so its not a DNS issue.

The ajax error handler is being triggered but I can't figure out why. They can lo开发者_开发知识库ad the page fine in a browser. The 3 parameters given to the error handler are not helpful. Here's a scrrenshot of their log; the 3 paramaters given to the error handler can be seen in 3 lines after "Facebook session errored out"

Error log image screenshot

As you can see, I have put in all the error catching I can think of, still nothing! Source:

$.ajax({'url': url, type:'POST', data: data, timeout: SERVER_TIMEOUT, success: function(d) {
    dlog('got login session data');
    dlog(d);
    try {
        d = $.parseJSON(d);
        callback(d);
    } catch(e) {
        errh('The JSON could not be parsed: '+d);
    }
}, error: function(x,t,e){
    dlog(x);
    dlog(t);
    dlog(e);
    callback({});
},statusCode: {
    404: function() {           errh('page not found');         },
    200: function() {           errh('200');                    },
    201: function() {           errh('201');                    },
    202: function() {           errh('202');                    },
    500: function() {           errh('internal server error');  }
}});
0

精彩评论

暂无评论...
验证码 换一张
取 消