jquery - Passing variable to window.location href -
this question has reply here:
how can create page redirect using jquery? 53 answers jquery location href? [duplicate] 6 answersi'm trying delay outgoing links when clicked, googles event tracking have time occur.
i wrote next code, i'm unsure of how pass variable window.location. adds string "url" , not link adress. doing wrong?
$("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); });
no need utilize jquery set property of location
object (and no need utilize jquery href
property of anchor object):
$("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); });
jquery redirect settimeout window.location
No comments:
Post a Comment