I want to put a query in a URL using JavaScript, how can I do that?
Horizon_Net
5,9994 gold badges33 silver badges34 bronze badges
2 Answers 2
Guess, document.location.search is what you're looking for
answered Jun 26, 2015 at 14:58
Dmitry Volokh
1,64616 silver badges28 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
answered Jun 26, 2015 at 15:01
hungndv
2,1662 gold badges19 silver badges20 bronze badges
4 Comments
FRP7
is there any away to add just one query? (instead of a infinite loop of queries)?
hungndv
You should make your question clearer. Could you make some illustration examples?
FRP7
to do something like this: original: server/myapp.php?id=10 what i want: server/myapp.php?id=10&enabled=true
hungndv
I think this would be simple:
window.location.href + '&enabled=true'lang-js
var foo = 'http://example.com?foo=bar'