jquery - JavaScript redirect with variables - Stack Overflow

So I have this JavaScript function getSearchVariable which basically acquires a variable from the URL u

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="?="+(getSearchVariable('Track')+"&tba=N"

Any idea on why something like the code above won't work?

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./tracer?="+(getSearchVariable('Track')+"&tba=N"

Any idea on why something like the code above won't work?

Share Improve this question asked Nov 8, 2012 at 0:39 henryaaronhenryaaron 6,21221 gold badges63 silver badges82 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Your parenthesis are not balanced.

document.location.href=
    "http://example./tracer?="+(getSearchVariable('Track')+"&tba=N"
//                                ^
//                                |
//                                +--- Remove this guy.

Because you are missing a )

document.location.href="http://example./tracer?="+(getSearchVariable('Track')+"&tba=N"
                                                     ^1                ^2      ^2

it should be

document.location.href="http://example./tracer?="+(getSearchVariable('Track'))+"&tba=N"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745635144a4637345.html

相关推荐

  • jquery - JavaScript redirect with variables - Stack Overflow

    So I have this JavaScript function getSearchVariable which basically acquires a variable from the URL u

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信