0
嘿,我正在做一个搜索框,当我想要页面重定向时,会有一些奇怪的东西出现。jQuery - 字符串从变量中消失
下面是脚本:
$('#search_form').submit(function(ev) {
var searchTerm = $("input[name = search_term]").val();
var search_location = conf_fullSiteAddress + "search/" + searchTerm + "/";
alert(search_location);
window.location.replace(search_location);
});
现在,我要的是重定向到http://www.myaddress/search/searchTerm/用户。
这甚至是我通过alert();函数,但我被重定向到http://www.myaddress/search//,它完全忽略了searchTerm并且它在字符串中,因为它会被警告!
任何人都知道发生了什么事?
谢谢,迈克。
耶,就是这样。谢谢。 – Mike 2010-07-19 04:00:16