简体   繁体   中英

How can I debug Google Chrome refusing to send an AJAX request?

My application uses jquery 1.7.1. The code that's failing looks like this:

    dialog = $("<div>").append($("<form class='ourformstyle'>Loading...</form>"));
    dialog.css({
        position: "absolute",
        top: "50px", 
        left: "50px",
        display: "block",
        zIndex: 3
    });
    $("body").append(dialog);

    dialog.load(uri, function () { 
        alert('success');
    });

"uri" is a local URI, defined relative to the current page (its value is "AdvertCreate?advertiser=1&campaign=4"). But in the load() function, I get an exception thrown that looks like this:

GET http://icandigital.com:81/icandigital/AdvertCreate?advertiser=1&campaign=4  jquery-1.7.1.min.js:4
  send jquery-1.7.1.min.js:4
  f.extend.ajax jquery-1.7.1.min.js:4
  f.fn.extend.load jquery-1.7.1.min.js:4
  showdialog Adverts:254 [this is the 'dialog.load' line above]

On the 'Network' tab of developer tools, Chrome shows the request's type as "pending" and status as "(failed)". The server doesn't appear to receive the request.

This problem shows up with the latest version of Chrome (26.0.1410.64) but seems to have worked with an earlier version (unknown, but would have been current approximately around the start of February). I no longer have that version for testing, but having ensured the site is identical now to how it was then, it certainly appears to be the case that some Chrome update has caused it.

Because the exception gives me no indication of why the request is failing, I'm at a loss as to how to debug this problem. Does anyone know a way of getting more info? Or maybe know what has been updated that might cause such a problem.

Update

The problem was being caused by AdBlock. As this is an internal site, I've just informed my clients they'll need to disable it for their own domain.

Never mind. It was AdBlock blocking the request, not a change in Chrome at all.

Try using another browser so that you can prove to yourself that the problem is chrome. Firefox with firebug plugin can provide you a lot of the same debugging functionality that Chrome does.

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