title: trying to get knockout js to check if data has come every 10 seconds
body: <p>I am trying to call the function which posts the ajax request to check the database, every 10 seconds to see if the required information I want has arrived or not, if the required information has not arrived for 60 seconds, I just want to exit the function.
  The problem I am having right now is that, my function doesnt call <code>self.startInstantorCheck</code> every 10 seconds, and then exits to the end after 60 seconds.
  Here is the function </p>
  
  <pre><code>self.startInstatorCheck = function(){
                  self.instatorStarts(true);
                  var MAX_WAIT_TIME_MS = 1 * 60 * 1000;
                  var POST_INTERVAL_MS = 10 * 1000;
                  var timeoutTime = null;
                  $.ajax({
                         type: 'POST',
                         url: BASEURL + 'index.php/moneyexchange/check_instantor_field/' + auth,
                        contentType: 'application/json; charset=utf-8'
                     })
                  .done(function(userinfo) {
                      if (timeoutTime == null) {
                        // Start of the timeout cycle:
                        timeoutTime = Date.now() + MAX_WAIT_TIME_MS;
                      }
                      if (userinfo.instantor_request &gt; 12) {
                        self.allInstantorCheckMessages('Instantor data gathered');
                      } else {
                        if (Date.now() &lt; MAX_WAIT_TIME_MS) {
                          setTimeout(self.startInstatorCheck(), POST_INTERVAL_MS);
                        } else {
                            self.allInstantorCheckMessages('Please go through instantor to ');
                            self.instatorStarts(true);
                            self.magicInstantorbtn2(true);
                        }
                      }
                   })
                 .fail(function(jqXHR, textStatus, errorThrown) {
                     self.errorMessage(errorThrown);
                 })
                 .always(function(data){               
                 });
          }
  I am using knockout js, so would be great if the answers or help are related to knockout js. 
  </code></pre>