0
我試圖從JS 調用後面方法的代碼,但它給了我這個錯誤(「NetworkError:401未經授權)調用後面方法的代碼從JavaScript
NetworkError: 401 Unauthorized
這裏是後面方法的代碼
[System.Web.Services.WebMethod]
public string ExtractToPDF(string FSID)
{
return FSID;
}
這裏是JS功能
function extractFile(FSID) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Update.aspx/ExtractToPDF",
data: "{"+FSID+"}",
dataType: "json",
success: function(data) {
alert(data)
},
error: function(result) {
alert("Error");
}
});
}
這裏是響應
{
"Message": "An error occurred during the processing of the request",
"StackTrace": "",
"ExceptionType": ""
}
可能重複: //stackoverflow.com/questions/23033614/asp-net-calling-webmethod-with-jquery-ajax-401-unauthorized) – 2015-03-03 08:29:55