Luca Detomi
Luca Detomi

Reputation: 5716

Reload page via jQuery changing value of a parameter

I have a page with URL like:

www.mydomain.com/orders.html?orderNumber=363035001&return=true

I need a way to reload the page via jQuery at a specific event, changing last parameter. So url to be reload should be:

www.mydomain.com/orders.html?orderNumber=363035001&return=false

Upvotes: 2

Views: 6961

Answers (3)

Using this you first get the URL form the current page, then change from true to false or viceversa, and then change the location.

URL = document.URL;

if(URL.indexOf('return=true') != -1)
       URL = URL.replace('return=true','return=false');
else
      URL = URL.replace('return=false','return=true'); 

window.location = URL;

Upvotes: 3

Abhishek Pachal
Abhishek Pachal

Reputation: 554

window.location.href="www.mydomain.com/orders.html?orderNumber=363035001&return=false"

Upvotes: 0

Yerko Palma
Yerko Palma

Reputation: 12329

You need to set your window.location var to the url you want.

window.location = "www.mydomain.com/orders.html?orderNumber=363035001&return=false"

Here is a simple example

Upvotes: 0

Related Questions