Reputation: 6192
So I have this JavaScript function getSearchVariable which basically acquires a variable from the URL using raw Javascript.
I need to redirect the user to a page with a URL with some static text before the variable and after the variable.
document.location.href="http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
Any idea on why something like the code above won't work?
Upvotes: 0
Views: 4742
Reputation: 490143
Your parenthesis are not balanced.
document.location.href=
"http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
// ^
// |
// +--- Remove this guy.
Upvotes: 3
Reputation: 207501
Because you are missing a )
document.location.href="http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
^1 ^2 ^2
it should be
document.location.href="http://example.com/tracer?="+(getSearchVariable('Track'))+"&tba=N"
Upvotes: 2