所有, 我有下面的代码:jQuery的重定向页面不工作的按钮点击
var site_url = 'http://localhost/website/';
jQuery("#cancel_song_choice").click(function(event){
cancel_url = site_url + "event-form";
window.location.href(cancel_url);
});
然后,我有以下的HTML:
<button id="cancel_song_choice">Cancel Search</button>
当我点击按钮,它只是将我重定向到我所在的页面,而不是转到我指定的取消网址。我提醒了cancel_url,它显示了我正确的一个。任何想法我做错了什么?
使用'了window.location = cancel_url;' –