Forum Moderators: open
Im trying to call a javascript function which includes dynamically a tracking image when someone clicking a link and then moving to that link:
<a onclick="track(12345);" href="http://www.test.com/">
and here are parts of my javascript functions:
function track(id){
ajax.requestFile = 'track.php?id='+id;
ajax.onCompletion = showContent;
ajax.runAJAX();
}
function showContent(){
contentObj.innerHTML = ajax.response;
}
the track function calls a php script which includes a tracking image in a div so the visitor will get a cookie. The Problem is that the visitor will be moved to the new page before the cookie is set.
Do you have any idea how I can let the script wait till the cookie is set?
thanks