如何从webmethod获取错误消息,我想发起错误。另外,我想为不同的场合提供不同的错误信息。从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
}
});
谢谢,这正是我所需要的。 – gormit