Sometimes you need to reload your webpage in javascript. If your page url contains some parameters, then you might be thinking of some complex javascript work to properly reload your webpage using javascript... But this should not be the case, javascript provide a "reload" function to trload the same page. That is accessible with document.location object.
Example- Code: Select all
document.location.reload( );
The above statement will reload the webpage along all the url parameters, etc. You can also use this fucntion alongwith the setTimeout() function if you want to delay the page re-loading.
- Code: Select all
setTimeout( function() { document.location.reload( ); }, 2000); // time in ms