title: javascript setTimeout function out of scope
body: <p>I am trying to call showUpload(); from within two setTimeouts. Neither works. It seems to be out of scope and I'm not sure why. I tried <code>this.showUpload()</code> which didn't work either.</p>
  
  <pre><code> $(document).ready(function(){
              var progress_key = $('#progress_key').val();
  
              // this sets up the progress bar
              $('#uploadform').submit(function() {
                 setTimeout("showUpload()",1500);
                 $("#progressbar").progressbar({ value:0}).fadeIn();
              });
  
  
              // uses ajax to poll the uploadprogress.php page with the id
              // deserializes the json string, and computes the percentage (integer)
              // update the jQuery progress bar
              // sets a timer for the next poll in 750ms
              function showUpload() {
                  $.get("/myid/videos/uploadprogress/" + progress_key, function(data) {
                      if (!data)
                          return;
  
                      var response;
                      eval ("response = " + data);
  
                      if (!response)
                          return;
  
                      var percentage = Math.floor(100 * parseInt(response['bytes_uploaded']) / parseInt(response['bytes_total']));
                      $("#progressbar").progressbar({ value:percentage})
  
                  });
                  setTimeout("showUpload()", 750);
              }
          });
  </code></pre>
  
  <p>Thank you for your time.</p>