Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/153.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html jQuery.post给出了错误消息_Html_Ajax_Jquery - Fatal编程技术网

Html jQuery.post给出了错误消息

Html jQuery.post给出了错误消息,html,ajax,jquery,Html,Ajax,Jquery,我试图让这个代码工作,但它给了我一个错误。它似乎没有执行 jQuery.post("getResults.php", {id:id} , function(data) { jQuery("select#kDate").removeAttr("disabled"); jQuery("select#kDate").html(data); }) .success(function() { alert("se

我试图让这个代码工作,但它给了我一个错误。它似乎没有执行

jQuery.post("getResults.php", {id:id} , function(data)
        {
            jQuery("select#kDate").removeAttr("disabled");
            jQuery("select#kDate").html(data);
        })
        .success(function() { alert("second success"); })
        .error(function() { alert("error"); })
        .complete(function() { alert("complete"); });
     });

任何帮助都将不胜感激。

错误函数有3个参数

 error(jqXHR, textStatus, errorThrown)
试试这个:

error(function(xhr, status, detail) { alert("error ("+status+") : " + detail); });
文档在这里:

试试这个:你也可以看到


您不需要2个成功函数..我只是在这里找到了该代码,并添加了它以尝试了解我的代码发生了什么。通过在error函数中记录传递的参数来了解有关错误的更多信息。另外:Firebug怎么说?如果您使用的是ChromeDeveloper,您可以通过执行
console.log(arguments)
来查看错误函数中的所有内容。。然后你可以浏览它们,“它给了我一个错误”不是很具体。这只是给了我一个错误:error@bobthemac-尝试新版本。我已运行此版本,但未收到错误found@bobthemac-这意味着它找不到URL--请尝试完全限定的URL
var id = "some-value";
jQuery.post("getResults.php?id="+id, function(data) {
  jQuery("select#kDate").removeAttr("disabled");
  jQuery("select#kDate").html(data);
})
.success(function() { alert("second success"); })
.error(function() { alert("error"); })
.complete(function() { alert("complete"); });