title: KnockoutJS best practice to populate multiple view models using Ajax
body: <p>I was wondering whether anyone had any recommendations regarding populating multiple view models on a screen. I have:</p>
  
  <p>a) a view model that has a list of tasks</p>
  
  <p>b) a view model that has a list of users</p>
  
  <p>I populate these in the 2 x ajax success (separate ajax calls) something like:</p>
  
  <pre><code>success: function (data) {
      masterVM.User = ko.mapping.fromJS(data, mapping);
      ko.applyBindings(masterVM); 
  }
  
  /* another ajax call: */
  success: function (data) {
      masterVM.Task = ko.mapping.fromJS(data, mapping);
      ko.applyBindings(masterVM); 
  }
  </code></pre>
  
  <p>And currently calling in each ajax success call. </p>
  
  <p>I hope my question is clear and concise. Please ask for further detail if required.</p>
  
  <p>Regards
  Phil</p>