Update page with jQuery
Today we’ll learn how to update our page using the JavaScript function location.reload and jQuery
JavaScript reload function
The easiest way to reload a page is the JavaScript function window.location.reload
Lest see an example
<body>
<!--Update button-->
<input type="button" id="update-page" value="Update">
</body>
<script>
// When all the page is charged
$(document).ready(function(){
// Button event
$("#update-page").click(function(){
// Reload the page
location.reload();
});
});
</script>
Other reload methods
There are other ways to reload the page. Let´s see someone
window.location = location.href; location = location; location = window.location; location = self.location.href;