Passing variable to window.location href
This question already has an answer here:
不需要使用jQuery来设置location
对象的属性(并且不需要使用jQuery来获取锚对象的href
属性):
$("a.private-product-order-button").click(function(e) {
e.preventDefault();
_gaq.push(['_trackEvent', 'Order buttons', 'Click', 'Service']);
var url = this.href;
setTimeout(function() {
window.location.href = url;
}, 200);
});
Because you're adding string after all.
It should be:
$(window.location).attr('href', url);
not
$(window.location).attr('href', 'url');
Use $(window.location).attr('href', url);
without the quotes around url.
上一篇: PHP标头():302移动临时错误