开发者

Using jquery $.ajax on window.onerror in ie

I got a script going on ff and chrome (don't care about safari) where when there is a javascript error it send an email.

开发者_如何学Python

It works on FF & chrome.

On ie8 I see the console.log or alert I added in the success of the ajax call but the call itself is never made, this makes me crazy that it actually goes into the success function

window.onerror = function (msg, url, line) {

    $.ajax({
        type:"GET",
        url:"jserrorhandler.php",
        data:"message="+msg+"&url="+url+"&line="+line+'&from='+settings.from+"&website="+settings.website,
        success: function(){
            if(window.console) console.log("Report sent about the javascript error")
        }
    })
    return true;
}


Not sure if this will make a difference but you are missing a semicolon after the ajax call.


I found the problem, IE was caching my ajax request, thats it...

$.ajax({
    type:"GET",
    cache:false
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜