Hi all,
I am trying to store a cookie when a link is clicked but for some reason it doesnt work 100%. The cookie is stored but not on click but on load (in js terms).
There are some other things too that I am going with the code below e.g. referrer and search referrer in order to determine where the user is coming from... but thats another story!
This is the cookie plugin am using:
http://plugins.jquery.com/files/jquery.cookie.js.txtAnd this is the code:
$(document).ready(function () {
//check if cookie exists and has already a value
if(($.cookie('myCookie')) !='value'){
//get referer
vReferrer = document.referrer;
//set referer to a variable
vSearchText = '1.1.1.1.1'; //my IP
//search variable
if(vReferrer.indexOf(vSearchText) != -1) {
//if found what we are looking for (IP or part of our domain) then trigger the pop-up box/nyromodal
$(document).ready(function () {
$('a.nyroModal').trigger('click');
});
}
}
// Up to here works fine.... the following doesnt... I tried to use a separate function for the click event but like that it doesnt work at all.
if($('a.nyroModalClose').click){
$.cookie('myCookie', 'value')
}
// alert($.cookie('myCookie'));
});
Any ideas?
Thanks
Dimitris