I need to reload the page after the OK button is clicked on the Alert box. I am using the following code for it
alert("Successful Message");
window.location.reload();
But the window is reloaded immediately after displaying the alertbox. Please Help me in it
Confirm gives you chance to click on cancel, and reload will not be done!
Instead, you can use something like this:
if(alert('Alert For your User!')){}
else window.location.reload();
This will display alert to your user, and when he clicks OK, it will return false and reload will be done! :) Also, the shorter version:
if(!alert('Alert For your User!')){window.location.reload();}
I hope that this helped!? :)