在页面的document.ready
中添加以下代码,向下滚动时获取用于使用Ajax调用从服务器端获取数据的记录并绑定数据。此代码在本地工作,但不在客户端计算机中工作。无法找到问题所在。
$(window).scroll(function () {
//debugger;
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
在控制台中我遇到以下错误:
未捕获的TypeError:$ .idleTimeout不是函数
上述错误的代码是:
<script>
var $countdown = $("#dialog-countdown");
var idealTimeout = (@Session.Timeout*60);
$.idleTimeout('#SessionIdleModal',
'.session_stayin_btn', {
idleAfter: idealTimeout -60, //one minute before
timeout:idealTimeout,
pollingInterval: idealTimeout/2, //polling half of the timeout interval for optimization
warningLength: 60,
keepAliveURL:'@Url.Action("KeepSessionAlive", "Account",null, Request.Url.Scheme)',
serverResponseEquals: 'OK',
onTimeout: function () {
window.location = '@Url.Action("LogOff", "Account", null , Request.Url.Scheme)';
},
onIdle: function () {
//$(this).dialog("open");
$('#SessionIdleModal').css("width", "520px").popup("show");
},
redirecttologout: function () {
$('#SessionIdleModal').hide();
window.location = '@Url.Action("LogOff", "Account", null , Request.Url.Scheme)';
// jQuery methods go here...
},
onCountdown: function (counter) {
$countdown.html(counter); // update the counter
$('#ss_count').text(counter);
}
});
</script>
在控制台中再收到一个错误
未捕获的TypeError:无法读取未定义的属性'defaults'
$.fn.popup.defaults.escape = false;