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.

3
  • do you want something like this: index.html?parameter1=val1&parameter2=val2 Commented Jun 23, 2010 at 10:32
  • 4
    Is this what you are after? stackoverflow.com/questions/486896/… Commented Jun 23, 2010 at 10:32
  • yes i want the same like u r mentioning Commented Jun 23, 2010 at 10:36

2 Answers 2

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;

Sign up to request clarification or add additional context in comments.

Comments

0
"http://localhost/demo/" + "?name=" + escape(name_var) + "&id=" + escape(id_var) 

1 Comment

but how can i add in my code so that it can work properly....

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.