Skip to content Skip to sidebar Skip to footer

Javascript Popups: Submit Form, Show "wait" Screen For 5 Seconds, Then Auto-close Popup

I have a popup that requires the user to fill out a form. Once the form is submitted, I need to take them to a 'Waiting' screen inside that same popup while their info is checked.

Solution 1:

here's a plunker: http://plnkr.co/edit/EAWf6EPauBuz36Wu8Erk?p=info

first thing's first, consider this answer on why you shouldn't use inline javascript.

in order to open a popup window you could use: window.open();

window.open(strUrl, strWindowName[, strWindowFeatures]);

after the popup opens, you can close it with window.close();

you'll need to set a timer, that'll wait 5 seconds and then close the popup

window.setTimeout(func, delay, [param1, param2, ...]);

Solution 2:

I solved this by including the following into the waiting page popup:

<scripttype="text/javascript">
$(document).ready(function() {
setTimeout(function(){ 
    window.opener.location.href = "parentpage.php";
    window.close();
}, 2000); 
});
</script>

That does the trick.

Post a Comment for "Javascript Popups: Submit Form, Show "wait" Screen For 5 Seconds, Then Auto-close Popup"