-1

Question: I want to change the url of page without refreshing but now when i checked on radio button the page refreshes and change the url. for Example,

My current Page url is: www.example.com/cart/

when i checked pickup, day and time radio button then page will refresh and shows url:

www.example.com/cart/?method_choice=pickup&time=12PM-3PM&day=tue

but i want page will not refresh and url will change when radio button is checked.

user1990
  • 1,007
  • 1
  • 10
  • 17
  • Please check:- http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page, http://www.aspsnippets.com/Articles/Change-Browser-URL-without-reloading-refreshing-page-using-HTML5-in-JavaScript-and-jQuery.aspx, http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page – Alive to die - Anant Jul 08 '15 at 13:02

2 Answers2

0

You are wanting the page to refresh?

// Reloads current page
document.location.reload();

// Go to page
window.location = "http://www.example.com/cart/?method_choice=pickup&time=12PM-3PM&day=tue";
  • You should use comments to ask questions, not answers – Djave Jul 08 '15 at 13:04
  • I was a little quick with my answer and noticed that I used the wrong location to ask a question. I then was in the process of creating an answer. No need to vote something down less than a minute after the post without giving the poster the ability to correct their mistake. – Brian Flaherty Jul 08 '15 at 13:08
0

you can use history.pushState();

For example:

history.pushState('', '', '/cart/?method_choice=pickup&time=12PM-3PM&day=tue');
Emircan Ok
  • 320
  • 2
  • 13