简体   繁体   English

如何调试Google Chrome拒绝发送AJAX请求?

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

My application uses jquery 1.7.1. 我的应用程序使用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"). “uri”是本地URI,相对于当前页面定义(其值为“AdvertCreate?advertiser = 1&campaign = 4”)。 But in the load() function, I get an exception thrown that looks like this: 但是在load()函数中,我得到一个抛出的异常,如下所示:

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)". 在开发者工具的“网络”标签上,Chrome会将请求的类型显示为“待处理”,状态显示为“(失败)”。 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). 此问题出现在最新版本的Chrome(26.0.1410.64)中,但似乎与早期版本一起使用(未知,但目前大约在2月初左右)。 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. 我不再拥有该版本进行测试,但确保该网站现在与当时的情况完全相同,但肯定会出现一些Chrome更新导致的情况。

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. 问题是由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. AdBlock阻止了请求,而不是Chrome中的更改。

Try using another browser so that you can prove to yourself that the problem is chrome. 尝试使用其他浏览器,以便您可以向自己证明问题是chrome。 Firefox with firebug plugin can provide you a lot of the same debugging functionality that Chrome does. 带有firebug插件的Firefox可以为您提供许多与Chrome相同的调试功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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