简体   繁体   English

该网站上线后,ajax请求被“取消”

[英]ajax request getting 'canceled' now that site is live

All of my AJAX requests were working perfectly fine when I had my new version in a sub directory of my site (www.staging.easyuniv.com). 当我的网站的子目录(www.staging.easyuniv.com)中有新版本时,我所有的AJAX请求都运行良好。 When I then moved the site located in staging into the main directory, making it live (www.easyzag.com), everything is working fine, however a couple of the AJAX requests that get sent come up as 'cancelled' when looking in the network tab of chrome dev tools. 然后,当我将暂存的站点移到主目录中并使其处于活动状态(www.easyzag.com)时,一切工作正常,但是,当在站点中查找时,收到的几个AJAX请求被“取消”了。 chrome开发者工具的网络标签。

显示

Others, which send the request to the exact same API file, work completely fine. 将请求发送到完全相同的API文件的其他服务器则可以正常工作。 Also, if I copy the url it sends the request to, I get a valid response. 另外,如果我复制将请求发送到的网址,则会得到有效的响应。

I tried to use the debugger and didn't really gain any insight. 我尝试使用调试器,但并没有真正获得任何见识。 Also, there are no errors in the console. 另外,控制台中没有错误。

Any ideas on what I should look into? 关于我应该研究的任何想法?

Thanks 谢谢

EDIT: it no longer works on staging either, so it has to be something that changed in the upload. 编辑:它不再在登台上也起作用,因此它必须是上载中已更改的内容。 The only confusing part is that, like I said, some of the requests do work, only a the deals/randomActive doesn't work 唯一令人困惑的部分是,就像我说的那样,某些请求确实有效,只有交易/随机有效不起作用

The issue is that your browser doesn't work the same way as making an ajax request. 问题是您的浏览器与发出ajax请求的方式不同。 Your browser will follow 301s, but ajax requests won't do that automatically (at least they probably won't). 您的浏览器将遵循301,但是ajax请求不会自动执行(至少它们可能不会执行)。 See this fiddle: http://jsfiddle.net/pRvKz/ 看到这个小提琴: http : //jsfiddle.net/pRvKz/

$.get("http://easyuniv.com/API/deals/randomActive/2/0/0",function(x){
    alert(x);
}).fail(function(){
    alert("oh no the non-www request failed");
});

$.get("http://www.easyuniv.com/API/deals/randomActive/2/0/0",function(x){
    alert(x);
}).fail(function(){
    alert("oh no the www request failed");
});

PS when making the above fiddle, I accidentally stumbled upon a SQL injection that you have. PS在进行上述操作时,我偶然发现了您进行的SQL注入。 Please fix it before someone else finds it yikes . 别人之前发现它亚克西请修复它。

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

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