【发布时间】:2011-07-11 06:40:53
【问题描述】:
如何从 webmethod 获取错误消息,我想启动错误。另外,我希望针对不同的场合提供不同的错误消息。
$.ajax({
type: "POST",
url: "betting.aspx/submitFunction",
data: JSON.stringify({ results: jsonObj, edit: $("#ctl00_ContentPlaceHolder1_CreateOrEdit").val() }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(arg) { //call successfull
window.location = "bHistory.aspx";
},
error: function(xhr) {
alert("Error! You need to login, and try again");
window.location = "login.aspx";
//error occurred
}
});
【问题讨论】: