我試圖讓這個asp.net函數的值:jQuery的PageMethod的稱法不存在
[ScriptMethod, WebMethod]
public static bool checkRefresh()
{
return isChanging;
}
使用PageMethod的調用它jQuery中:
var isAllowed = false;
$("#edit").click(function() {
PageMethods.editFunc();
PageMethods.checkRefresh(DisplayMyResult); //this line gives the error, though it's probably because it's first.
});
function DisplayMyResult(ResultString) {
isAllowed = ResultString;
if (isAllowed == true || isAllowed == "true") {
location.reload();
}
else {
PageMethods.checkRefresh(DisplayMyResult);
}
}
錯誤我得到(在鉻控制檯)是
Uncaught TypeError: Object function() {
PageMethods.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
} has no method 'checkRefresh'
我不知道爲什麼它不工作,任何人都可以幫忙嗎?
任何人......?幫幫我..? –