title: Grid Refresh using knockout js
body: <p>I am very new in knockout js and have been trying to refresh the Grid using knockout.
  here is my view model</p>
  
  <pre><code>var GridViewModel = function () {
      var _this = {};
  
  
  
      _this.mainData = ko.observableArray();
  
    _this.DataFromServer= function()
      {
          var _transactions = $.getJSON('/data/getData', '', function (response) {
              if (response) {
  
                  var results = ko.observableArray();
                  _this.mainData.removeAll();
                  results = response.mainData;
                  for (var i = 0; i &lt; results.length; i++) {
                      _this.mainData.push(results[i]);
                  };
  
              }
          });
    }
  
  ko.applyBindings(_this);
      _this.DataFromServer();
      return _this;
  
  }
  
  
  var viewModel = GridViewModel();
  </code></pre>
  
  <p>Above code works fine and binds the data from server to grid but I am not sure how to bind this again after every 10 secs</p>
  
  <p>I have been using the setInterval after Viewmodel call like this</p>
  
  <pre><code> var viewModel = GridViewModel();
  
   setInterval(new GridViewModel(), 10000);
  </code></pre>
  
  <p>but this is not working. please advise.</p>