[英]No response in Firebug from jQuery ajax request
I'm trying to make a really simple ajax request in jQuery from http://dev.example.com/shop/category
which looks like this: 我正在尝试从
http://dev.example.com/shop/category
在jQuery中提出一个非常简单的ajax请求,如下所示:
$.post("http://dev.example.com/ajax/test.php", function(data) {
alert("loaded");
});
No response is returned and Firebug's Status field is blank. 没有响应返回,并且Firebug的“状态”字段为空白。 Chrome says "(canceled)".
Chrome说“(取消)”。
The test.php works fine when I open it in the browser. 当我在浏览器中打开test.php时,它可以正常工作。
It's on the same domain so I don't think it's a cross-site issue (I've tried a relative path too). 它在同一个域中,因此我认为这不是跨站点问题(我也尝试过相对路径)。
Any ideas? 有任何想法吗?
It was because my script was doing something else without waiting for the result of the ajax request. 这是因为我的脚本正在做其他事情,而没有等待ajax请求的结果。 I just used
$.ajax
with async:false
and it worked! 我只是将
$.ajax
与async:false
,它起作用了! Thanks to everyone who commented. 感谢所有发表评论的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.