【发布时间】:2012-12-01 00:57:19
【问题描述】:
我正在尝试获取这个 asp.net 函数的值:
[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);
}
}
我得到的错误(在 chrome 控制台中)是
Uncaught TypeError: Object function () {
PageMethods.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
} has no method 'checkRefresh'
我不知道为什么它不起作用,有人可以帮忙吗?
【问题讨论】:
标签: jquery asp.net ajax webmethod pagemethods