一旦用户点击删除按钮,我的jQuery脚本会要求服务器删除所选项.
谢谢
我的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 } );
header("HTTP/1.0 404 Not Found"); header('HTTP',true,500); // 500 internal server error // etc etc..
查看header()了解更多选项.所有的HTTP错误代码都可以使用.
相关问题:How do you trigger the “error” callback in a jQuery AJAX call using ASP.NET MVC?