【发布时间】:2016-12-24 01:29:22
【问题描述】:
我有 php 脚本,使用 jquery ajax 函数触发。是这样的:
$("a.test").click (function () {
var new_id = $(this).attr("new_id");
$.ajax({
url: 'test.php',
type: "POST",
cache: false,
async: true,
data: ({
new_id : new_id
}),
success: function (data) {
alert (data);
},
error: function(){
alert('error');
}
});
return false;
});
现在,在 test.php 中有一些错误,但我看不到它们。 Sript 只是运行,我没有反馈,只有错误警报(alert ('error'))。
我怎样才能找回 test.php 中的错误来处理它们?
【问题讨论】:
-
最简单的解决方案是打开控制台并转到网络选项卡并查看请求的响应。此解决方案是如果您不想更改代码。
标签: php jquery ajax error-handling