0

I have a simple table with data that refreshes automatically ever 60 secs. Now in this tables users can click on a TD to modify its data and I made so that everytime you toggle the TD's cell it adds/removes the class pauseInterval and thats working fine. Now what I am trying to accomplish is how do I pause the SetIterval when my TD has the class pauseInterval?

Seems like a simple question but im not understanding some of the examples that other people post as it does not deal with my scenario. I would apprecaite any help at this point.

<script type="text/javascript">
function reload() {
$.ajax({
    async: false,
    cache: true,
    url: "http://ensemble-mtl.ent.cginet/sites/SERVIPCManagement/imc/Shared%20Documents/Whiteboard/whiteboard.aspx",
    complete: function (xData, Status) {
        var DVWPMarkup = $(xData.responseText).find("#reload_me2").html();

        $("#reload_me").html(DVWPMarkup);
        highlightcode_IM();
        highlightcode_SM();
        initCustomEditFunction(argObj); 
    }
});
}

$(document).ready(function(){ 
    reload();
    var auto_refresh = setInterval(function(){reload();}, 60000); 
});
</script>
Chen-Tsu Lin
  • 22,876
  • 16
  • 53
  • 63
Daniel Ellison
  • 1,339
  • 4
  • 27
  • 49
  • You can check `hasClass` in your interval function var auto_refresh = setInterval(function() { if (!$('').hasClass('pauseInterval')) reload(); }, 60000); – Chen-Tsu Lin May 01 '15 at 04:10
  • Yeah, exactly. Check Aart den Braber's example in the answer you're being referred to. –  May 01 '15 at 04:13
  • Actually I looked at at the exact same post before I created this new post lol I wasent understanding the logic behind the script but with Chen-Tsu Lin's example it made more sense now. Looks like I screwed it up when i was testing it. Thank you guys for the quick response tough ;) – Daniel Ellison May 01 '15 at 04:47

0 Answers0