title: Stop Function From executing after condition is met
body: <p>My html page fires off 2 php scripts, one to perform a task and another to poll a log file and show results on the html page.  After the 'updatestock.php' has finished how do I stop the getStatus() process?</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
      $(function() {
          startProcess();
          getStatus();
  
      });
  
      function startProcess() {
  
        $("#done").load('updatestock.php');
  
      }
  
      function getStatus() {
  
        $("#status").load('getstatus.php');
          setTimeout("getStatus()",2000);
  
      }
  
      &lt;/script&gt;
  </code></pre>