tags:

views:

21

answers:

1

I am trying to set a cookie with a delayed amount of time.

I want the cookie to be set after 80 minutes on the page.

here is my code -

$(document).ready(function() {
            // Set the cookie after 81 mins so the next visit has the button
            $.cookie('EVGSalesLetter', 'visited').delay(4860000); 
        });
+5  A: 

.delay() is for the animation queue, to just generally set a timer use setTimeout(), like this:

setTimeout(function() { $.cookie('EVGSalesLetter', 'visited'); }, 4860000);

I didn't stick this in a document.ready because I'm assuming (hopefully safely...) that ater 81 minutes your page has fully loaded :)

Nick Craver
This is of course 81 minutes continuously on the page as opposed to 81 cumulative minutes on the page (which could be tracked with a cookie)
Peter Ajtai
Thanks man, that worked like a charm!
M.Woodard
@MWoodard - welcome :)
Nick Craver