7

I want to reload a page using JavaScript passing different parameters in URL.

My Page name is test1.aspx, I used:

window.location="test1.aspx?user=abc&place=xyz";

It's not working...!!!

Travesty3
  • 14,608
  • 6
  • 56
  • 96
Prasad Jadhav
  • 4,896
  • 16
  • 60
  • 80
  • possible duplicate of [How can I make a redirect page in jQuery/JavaScript?](http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery-javascript) – Alex May 15 '12 at 13:46

3 Answers3

15

window.location is an object. You need to access the href property on it, like this:

window.location.href="test1.aspx?user=abc&place=xyz";
Elliot Bonneville
  • 49,322
  • 23
  • 92
  • 122
2

If you need to send dynamic value, then

var user = "abc";
var place = "xyz";

window.location.href = "test1.aspx?user=" + user + "&place=" + place;
zeebonk
  • 4,604
  • 4
  • 20
  • 30
Moddasir
  • 1,406
  • 13
  • 31
0
window.location = "path page?user=" + $("#txtuser").val();
kleopatra
  • 50,242
  • 28
  • 96
  • 201
hadi.sh
  • 121
  • 1
  • 4