How to store variable within javascript to limit number of http calls?
<p>I am using a second party file downloader which returns a progress event.  I can capture the event and call a program on the server to perform an update (for security purposes so I can tell the most recent activity).</p>

<p>I get about 30 events per second all at percent downloaded 1%, then 30 more at 2%, then 30 more at 3%, etc.  I would like to limit my http calls to only once per percentage change, 1%, 2%, 3%, etc.  I would put a hidden field on the page and compare that and update it, but I cannot refresh the page since the download is in progress.</p>

<p>Is there a way to use some type of client side storage within javascript or jquery for this?</p>

<p>In other words, I need to be able to tell when the PercentCurrent value changes from 1 to 2, etc.</p>

<p>My javascript function looks like this:</p>

<pre><code>         function onProgress(PercentTotal, PercentCurrent, Index){
            var xmlhttp;

            //The handler will update the file progress
            if (typeof XMLHttpRequest != 'undefined') { 
                xmlhttp = new XMLHttpRequest(); 
            } 
            if (!xmlhttp) { 
                throw "Browser doesn't support XMLHttpRequest."; 
            } 
            var data = ""; 
            xmlhttp.open("POST", "UpdateProgress.aspx?PercentCurrent=" + PercentCurrent, true); 
            //Send the proper header information along with the request 
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
            //xmlhttp.setRequestHeader("Content-length", data.length); 
            xmlhttp.setRequestHeader("Connection", "close"); 
            xmlhttp.send(data);
        }
</code></pre>

<p>Thank you,
 Jim</p>
