如何從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