Javascript/Jquery call function every 5 minutes for an 8 hour period
<p>I need to call a function every 5 minutes for an 8 hour period.  The catch is it must be the on the same day.  For example if the user logs onto the system at 11:59pm on 3/29 and it's now 12:01am on 3/30 the function should no longer be called.</p>

<p>I know how to call it ever 5 minutes and have the jquery ajax call coded.  That part is fine.  My problem is figuring out the date.  Will someone please assist me?  I can provide more detail if needed.</p>

<p>Thank you kindly in advance,</p>

<p>Nathan</p>

<p>Sorry I forgot the code:</p>

<pre><code>var startDay;

function keepAlive(currDay) {
    var today = new Date().getDate();
    if (currDay == today) {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: "{ alive: 'true' }",
            url: "../ses/imsi_ses_edit.aspx/KeepSessionAlive",
            dataType: "json",
            success: function(data) {
            },
            error: function(response) {
                alert(response.responseText);
            }
        });
    }
}
window.onload = function() {
    startDay = new Date().getDate();
    keepAlive(startDay); //Make sure the function fires as soon as the page is loaded

    setTimeout(keepAlive, 300000); //Then set it to run again after five minutes
}
</code></pre>
