auto refresh every 2 minutes with checkbox

Posted on 2014-08-14
Last Modified: 2014-08-15

I need a checkbox, that when a user check it, then the page auto refresh every two minutes and after each refresh the checkbox remains checked until the user uncheck it, then after unchecked the auto refresh stops. Any idea?
Question by:joyacv2
    LVL 28

    Expert Comment

    How about this:

    <input type="checkbox" name="toggle" value="1"
             onclick="location.href='yourpage.php?tab=<%=tab%>&toggle=' + (cb.checked ? 1 : 0 );"
             <%IF toggle=1 THEN echo "checked" %> 

    Open in new window

    LVL 58

    Accepted Solution

    <input type="checkbox" name="toggle" value="1" autocomplete="off">
    <script src="//"></script>
    if(window.location.hash == "#refresh"){
    	pageRefresh = setTimeout(function(){window.location.reload()}, 120000);
    		window.location.hash = "refresh";
    		pageRefresh = setTimeout(function(){window.location.reload()}, 5000);

    Open in new window

    LVL 1

    Author Closing Comment

    works perfect!

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
    Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now