Refresh/Reload the Page Using jQuery

I have a button in my web page and I want to refresh or reload the page on button click event . I will use the following code for this.
  1. <html xmlns="http://www.w3.org/1999/xhtml">  
  2. <head>  
  3.     <title>Reload/Refresh Page</title>  
  4.     <script type="text/javascript"  
  5.         src="http://code.jquery.com/jquery-latest.js">  
  6.     </script>  
  7.    
  8.     <script type="text/javascript">  
  9.         $(document).ready(function() {  
  10.             $('#btn').click(function() {  
  11.                 location.reload();  
  12.             });  
  13.         });       
  14.     </script>  
  15. </head>  
  16. <body>  
  17.     <input id="btn" type="button" value="button" />  
  18. </body>  
  19. </html>  
The location.reload() method is used to refresh/reload the web page, so when we click on the button, page will be refresh. It is similar to press the F5 button.
Ebook Download
View all
Learn
View all