0

This must be very simple question .

I have a script to set cookie like this

<script>
$(document).on('pagecreate','#outerPage',function(e) {

   var windowWidth = $(this).width();
  // alert(windowWidth);
   if(windowWidth <290)
   {    
       console.log('cookie :small');
       $.cookie("adds", 0);
       //setTestCookie("adds","0");
   }
   else
   {   
         console.log('cookie :Big');
       $.cookie("adds", 1);

       //setTestCookie("adds","1");
   }
});
</script> 

So if these cookies are set I am displaying or hiding a google add using php if() else statement simple as of now.

Till now I have been using this function called setTestCookie() but there was a problem that the if else statement was working on when I load the page two time . that means the cookies where setting only after loading the page twice .

So I went to Jquery website and used this function $.cookie() to set the cookie but it result into loading page Image and the webpage never loads.

Any one has any idea why is this happening .

In short when I use $.cookie() the page loader Image shows but the page never loads .

ERROR in Console

Uncaught TypeError: undefined is not a function 

Thanks & Regards

Vikram Anand Bhushan
  • 4,836
  • 15
  • 68
  • 130

0 Answers0