【发布时间】:2013-01-28 19:28:10
【问题描述】:
我试图在点击时延迟传出链接,以便谷歌事件跟踪有时间发生。
我编写了以下代码,但不确定如何将变量传递给 window.location。它只是将其添加为字符串“url”而不是链接地址。我做错了什么?
$("a.private-product-order-button").click(function(e) {
e.preventDefault();
_gaq.push(['_trackEvent', 'Order buttons', 'Click', 'Service']);
var url = $(this).attr("href");
setTimeout(function() {
$(window.location).attr('href', 'url');
}, 200);
});
【问题讨论】:
-
window.location.href=url - 你已经结束了 jQuerying
-
@mplungjan:这样的事情可能吗?
标签: jquery redirect settimeout window.location