3

Possible Duplicate:
Adding a parameter to the URL with JavaScript

If I wanted to add 2 suppose name and id values to URL. How can I do that using JavaScript?

Suppose we have URL: http://localhost/demo/, then how to add these 2 parameters.

Community
  • 1
  • 1
rajesh
  • 1,413
  • 2
  • 17
  • 23

2 Answers2

1

If you're trying to redirect to a location with javascript, try: location.href="http://localhost/demo/?" + id + "=" + value + "&" + id2 + "=" + value2

If you just want to modify what's in the navigation bar

location.hash = id + "=" + value;

Thomas Shields
  • 8,874
  • 5
  • 42
  • 77
0
"http://localhost/demo/" + "?name=" + escape(name_var) + "&id=" + escape(id_var) 
Dutow
  • 5,638
  • 1
  • 30
  • 40