javascript - setTimeOut function not working as expected -
javascript - setTimeOut function not working as expected -
i having hard time settimeout function .let me show code first.
here code :-
function submitform(loginurl, username, password) { seek { loc = new string(window.location); document.forms.frm_login.action = junctionurl; document.forms.frm_login.username.value = username; document.forms.frm_login.password.value = password; document.forms.frm_login.submit(); settimeout(gotohomepage,4000); } grab (e) { alert(e.message +"submit form"); } } function gotohomepage() { alert("test"); var url = "test.aspx"; window.location=url; }
but here gotohomepage function not @ triggered after specified 4 seconds.
what doing wrong here.please suggest .
any help appreciated.
thanks
form submission redirecting result page unload
ing current page. so, timer doesn't tick.
use ajax or set target of form iframe. way, current page doesn't unload , timer ticks executing timeout function.
<form target="form_output"> <!-- other inputs --> </form> <iframe name="form_output"></iframe>
javascript
Comments
Post a Comment