-1

this is my html

<a href="http://127.1.1.0:8001/gembead/emstones.html?car=36">Car</a>

Basically i want to redirect to this page with parameter but i dont want my page to load. How can i do this. I am sure there will be a solution for this.

  • 1
    Redirect without a page load? You'll probably need some sort of client-side routing. – evolutionxbox Jan 27 '20 at 11:07
  • You can try to do this (it works only with the same origins): `window.history.pushState('page2', 'Title', 'http://127.1.1.0:8001/gembead/emstones.html?car=36');` – demkovych Jan 27 '20 at 11:08

2 Answers2

0

Try this (+info here):

function withoutLoading(url) {
   window.history.replaceState(null, null, url);
}
a {
  cursor: pointer;
}
<a onclick="withoutLoading('/gembead/emstones.html?car=36')">Car</a>
Ricardo Rocha
  • 8,628
  • 9
  • 53
  • 91
0

If you want to redirect to a new link without reloading your current page, you have to use window.hostory.push('url') or window.hostory.replace('url') on the onclick event of your button or anchor tab.