Jquery setTimeout function use and example:
Jquery setTimeout: the setTimeout() method is very easy to make a function call or an expression evaluation later. You can use in your websites for more work purpose.
setTimeout is a JavaScript function which calls a function after a specified delay or executes codes. This method is needed when you hidden popup or modal on your page without click close button. For example, if you generate a model or popup in your web page and user give some details in model or popup display some message to a user. User want to close the popup or model from the page, but using setTimeout() method, they could not do it. Model or popup automatic hide on the screen.
If your information passes by jQuery and after success your work you want to refers your web page after few seconds, then you need to follow this code.
For Example:
<script> function(isConfirm){ if (isConfirm) { setTimeout("location.reload(true);",2000); } } </script>
Try it:
<script> $.ajax({ type: 'post', url: 'submit.php', data: {name:name, email:email, phone:phone}, success: function(result){ setTimeout(function(){ $('#success').slideUp('slow').fadeOut(function() { window.location.reload(); }); }, 2000); } }); </script>
In your web pages you can use this method after submit, retrive, delete, update data from database by jQuery. It work on the page before use intraction.