小编nee*_*jax的帖子

如何调试jQuery Ajax请求?

我的代码是:

var test = "it isn't working";
var response = $.ajax({
    type: 'GET',
    url: 'jquerydemo.php', //This is in the same site as the page calling this request, so it's not a same-domain error.
    success: function(){
            test = "it's working";
        },
    error: function(){
            alert("Error detected");
        }
 }).responseText;
alert(test);
Run Code Online (Sandbox Code Playgroud)

我测试了状态代码,它出现了200并且错误函数永远不会消失,但成功函数也没有.就像我在评论中所说的那样,它不是同源政策错误.它只是停留说"它不起作用".这里发生了什么?

javascript ajax jquery

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1