I have a aspx page that takes along time to post due to toomany codes and db connection. 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. But when I run the code I get InternalError: too much recursion?
Please help My code is as follows.
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" OnClientClick="return disable();" />
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! Replace every
setTimeout( showmsg() ,....) to
setTimeout( showmsg ,.....)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.