带变量的JavaScript重定向
我有一个JavaScript函数getSearchVariable,它基本上使用原始JavaScript从URL获取一个变量 我需要将用户重定向到一个带有URL的页面,该URL在变量前后都有一些静态文本带变量的JavaScript重定向,javascript,jquery,variables,redirect,href,Javascript,Jquery,Variables,Redirect,Href,我有一个JavaScript函数getSearchVariable,它基本上使用原始JavaScript从URL获取一个变量 我需要将用户重定向到一个带有URL的页面,该URL在变量前后都有一些静态文本 document.location.href="http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N" document.location.href="http://example.com/tracer?="+
document.location.href="http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
document.location.href="http://example.com/tracer?="+(getSearchVariable('Track'))+"&tba=N"
你知道为什么上面的代码不起作用吗?你的括号不平衡
document.location.href=
"http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
// ^
// |
// +--- Remove this guy.
你的括号不平衡
document.location.href=
"http://example.com/tracer?="+(getSearchVariable('Track')+"&tba=N"
// ^
// |
// +--- Remove this guy.
因为你错过了一个)
应该是
因为你错过了一个)
应该是