一旦用户单击删除按钮,我的 jQuery 脚本就会要求服务器删除所选项目。
现在我希望我的php脚本发送成功或错误响应。
如果无法删除该项目,是否可以触发错误回调?
谢谢
我的 jQuery 代码:
$.ajax({
type: "post",
url: "myAjax.php" ,
dataType: "text",
data: {
some:data
},
error: function(request,error)
{
// tell the user why he couldn't delete the item
// timeout , item not found ...
},
success: function ( response )
{
// tell the user that the item was deleted
// hide the item
}
);