Hi,
I am just starting out with javascript so may be doing something really stupid so please forgive my ignorance. I am trying to build a slide up advert which only shows if a cookie has not been set to hide it. I have some code for the slider that works but i want to add to that code to do the If cookie is set don’t show part.
this is what i have
<script type="text/javascript">
$(document).ready(function(){
if(readCookie("offer") !==''){
$.ajaxSetup({cache:false});
$('#triqui_ad').wrap('<div id="triqui_container"></div>');
$('#triqui_ad').load('ajax.php',function(){
$('#triqui_ad').css('display','block');
$('#triqui_container').hide().delay( 900 ).slideDown('slow');
$('#triqui_ad').append(' • <a id="triqui_ad_close">Close</a> ');
$('#triqui_ad_close').click(function(){
$('#triqui_container').slideUp('slow');
});
});
}
else{
document.write('the cookie says no')
};
});
At the moment it works if the cookie is set to empty but if i put a value in then the page loading icon in the browser continues to try and load something. I assume it is not finishing something that it should. I can’t see what i need to change to end it as to me it looks like it should be ok as if the cookie is empty or not set the slider runs and if it is set and has a value then it should just print out ‘the cookie says no’.
what am i missing?
I’m using these functions ot set and unset things http://www.sitepoint.com/how-to-deal-with-cookies-in-javascript/