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. This is a prototype, so it only needs a delay of about 5 seconds as nothing is actually being checked. Then I'd like to close the popup automatically after that delay, instead of using window.close();
attached to a button.
Here's the script I'm using: (edited to remove inline js)
function centeredPopup(url,winName,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}
$('#linkPopup').click(function(){
$(this).click(centeredPopup("popup.php","Popup Name","680","560"));
if(window.location.href=='popup_waiting.php'){
setTimeout(function() {
close.window();
}, 5000);
}
});
How I'm firing the popups:
<a class="button" id="linkPopup">Popup Link</a>
Using my code above, the form just submits to the waiting screen but doesn't close it out after the specified duration, so I'm assuming there's something wrong with my syntax or structure.
Expected Behavior: