Javascript 对于prototype.js,我为什么可以';在浏览器中看不到onSuccess的调试信息?
我在prototype.js(1.6)中使用了Javascript 对于prototype.js,我为什么可以';在浏览器中看不到onSuccess的调试信息?,javascript,jquery,ajax,prototypejs,Javascript,Jquery,Ajax,Prototypejs,我在prototype.js(1.6)中使用了Ajax.Request,如下所示: new Ajax.Request(URL, {method: "get", onSuccess: cbFn, onCreate: function(req) { $("fetchBtn").value = "Fetching..." }, onFailure: function(req){ c
Ajax.Request
,如下所示:
new Ajax.Request(URL, {method: "get",
onSuccess: cbFn,
onCreate: function(req) {
$("fetchBtn").value = "Fetching..."
},
onFailure: function(req){
console.log(req)
alert("nima")
},
parameters: {"id": pmid}});
但是,cbFn
中有一个bug,当Ajax.Request
调用cbFn
时,它会在有bug的语句中停止。但是,它只是静静地停止了,因为我看不到Firebug中的错误信息。我也尝试了onFailure
,但当onSuccess
失败时,它似乎甚至没有被调用
有人知道如何检查cbFn
函数的调试信息吗?谢谢 我看到您一直在java脚本中使用jquery。在这种情况下,您可以使用jqueryajaxget/POST高效地解决问题。
诸如此类的事情:
jqxhr = $.get("example.php", function() {
alert("success");
})
.done(function() { alert("second success"); })
.fail(function() { alert("error"); })
.always(function() { alert("finished"); });
jquery在多浏览器中更适合您此外,PrototypeJS的最新版本是1.7.1。如果您有能力,请尝试升级。