tags:

views:

27

answers:

2

I have the following line of code -

<a href="/wordpress/wp-content/trackclicks/clickcounter.php?var=<?php echo $var3; ?>" onclick="return popitup2();">Grab Coupon</a>

But suppose i want to redirect the current page to an external link and also run the php script and the javascript function.Is something like this possible -

<a href="{@extlink}" onclick="/wordpress/wp-content/trackclicks/clickcounter.php?var=<?php echo $var3; ?>; return popitup2(); ">Grab Coupon</a>
+1  A: 

You are looking for Ajax. Here are the docs for the JQuery variety.

Pekka
A: 

Either use javascript to call the clickcounter using ajax, or move the redirect into your click counter script, eg:

clickcounter.php?var=<?php echo $var3; ?>&redirect=example.com

cam8001
so this redirect would be passed to the php script as a GET variable same as var?
ayush
yep, it would be available as $_GET['redirect'].
cam8001