1
我是jQuery的新手。我需要在一段时间后调用方法。需要调用jQuery ajax页面方法
$(document).ready(function pageLoad() {
setTimeout('SetTime2()', 10000);
});
(function SetTime2() {
$.ajax({
type: "POST",
url: "MyPage.aspx/myStaticMethod",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
// Replace the div's content with the page method's return.
//$("#Result").text(msg.d);
}
});
});
它说,未捕获的ReferenceError:未定义SetTime2。 什么是正确的语法?谢谢。
是否有页面上的任何JS错误。如果您使用的是Chrome浏览器,请点击重新加载并查看是否有错误。 –
删除围绕函数SetTime2方法的括号后尝试 –