refresh page without reloading using javascript code example
Example 1: javascript change url without reload
window.history.pushState('', 'New Page Title', '/new-url.php');
Example 2: change href without reloading page js
const nextURL = 'https://my-website.com/page_b';
const nextTitle = 'My new page title';
const nextState = { additionalInformation: 'Updated the URL with JS' };
window.history.pushState(nextState, nextTitle, nextURL);
window.history.replaceState(nextState, nextTitle, nextURL)
Example 3: javascript reload page without refresh
<a href="javascript:window.top.location.reload(true)" class="continue">Continue</a>
Example 4: update html page without refresh
$(function(){
$.ajaxSetup ({
cache: false
});
var ajax_load = "<img src='http://automobiles.honda.com/images/current-offers/small-loading.gif' alt='loading...' />";
var loadUrl = "http://fiddle.jshell.net/deborah/pkmvD/show/";
$("#loadbasic").click(function(){
$("#result").html(ajax_load).load(loadUrl);
});
});