[英]start auto refresh page with click on button
i have a update panel that contain gridview i wanna this page be auto update. 我有一个包含gridview的更新面板,我想将此页面自动更新。 i wrote fallowing snippet but my problem that when i locate this code in document.ready its work Properly but when i locate it in on click of button it dont work its my code; 我写了一些小片段,但是我的问题是,当我在document.ready中找到此代码时,它的工作正常了,但是当我单击按钮找到它时,它的代码却不起作用;
var temp;
$(document).ready(function () {
var refreshId = setTimeout(function () {
if (temp == 1) {
$('#menu').load('WebForm11.aspx');
}
}, 5000);
});
function Button2_onclick() {
temp = 1;
}
Try SetInterval insteadof SetTimeout 尝试使用SetInterval而不是SetTimeout
var temp;
$(document).ready(function () {
var refreshId = SetInterval(function () {
if (temp == 1) {
$('#menu').load('WebForm11.aspx');
}
}, 5000);
});
function Button2_onclick() {
temp = 1;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.