[英]InternalError: too much recursion - getting in jquery
I have a aspx page that takes along time to post due to toomany codes and db connection. 由于异常代码和数据库连接,我有一个aspx页面需要花一些时间才能发布。 That is not a problem. 那不是问题。 I need to disable the post button when the user clicks it which I am able to do. 我需要在用户单击它时禁用发布按钮。 The second thing that I want to accomplish is to change the button value to Please Wait .... To accomplish this I am using settime out so that after every 1 second a dot is appended to it. 我要完成的第二件事是将按钮值更改为Please Wait...。要实现此目的,我正在使用settime out,以便在每1秒后将一个圆点附加到它上面。 But when I run the code I get InternalError: too much recursion? 但是,当我运行代码时,我得到InternalError:太多的递归?
Please help My code is as follows. 请帮助我的代码如下。
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" OnClientClick="return disable();" />
JS JS
var m = "Please Wait";
function disable() {
try {
$("input[type=submit]").attr("disabled", "disabled");
setTimeout(showmsg(), 5000);
} catch (e) {
alert(e);
}
return true;
}
function showmsg() {
if (m.length > 15) {
m = "Please Wait";
}
m = m + ".";
$("<%=Button1.ClientID %>").val(m);
setTimeout(showmsg(), 1000);
}
Try this 尝试这个
setTimeout(showmsg, 5000);
and let me know 让我知道
You are not passing showmsg as a function but you are executing it! 您没有将showmsg作为函数传递,而是在执行它! Replace every 更换每一个
setTimeout( showmsg() ,....) to setTimeout( showmsg() ,....)
setTimeout( showmsg ,.....) setTimeout( showmsg ,.....)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.