使用jquery无法正常工作从主页重定向到其内容页面

时间:2017-05-24 04:44:40

标签: javascript jquery

我在enter key

的keyUp事件上调用了这个方法
   function PerformSearch(search_key) {
                    var url = "<%=ResolveUrl("/Test/TestPage.aspx?type=search&search_key=")%>" + search_key;

                    //GoToLocation(url);
                    //window.open(url);
                    //$(location).attr("href", url);
                    //window.location.replace(url);
                    window.location.href = url;
                }

2 个答案:

答案 0 :(得分:1)

像这样使用

window.location = url;

供参考read this

答案 1 :(得分:0)

您的网址中存在字符串连接错误。

此:

var url = "<%=ResolveUrl("/Test/TestPage.aspx?type=search&search_key=")%>" + search_key;

应该是这样的:

var url = "<%=ResolveUrl('/Test/TestPage.aspx?type=search&search_key=')%>" + search_key;
相关问题