title: Return Partial View and JSON from ASP.NET MVC Action
body: <p>I'm introducing KnockoutJS into an existing app. My plan is to modify/utilize the existing partial views that we've already created and bind them to the JS view models with Knockout's declarative attributes. When I make an AJAX call to an action, ideally I'd like the action to return both the HTML of the partial view and JSON object. Then I can fill a div with the HTML, convert the JSON to a Knockout object and bind it to the HTML. But I can't figure out how to return both from the action.</p>
  
  <p>I need the full view model because I'll be updating it and eventually sending it back to the server.</p>
  
  <p>I thought about having the action return the partial view (already bound to the model), and within the partial view, include javascript to convert the .Net model into a Knockout object. But I feel that scattering the JS around like that is messy and unmaintainable. I'd rather have everything close to the original ajax call.</p>
  
  <p>I guess another alternative is to make two action calls. One for the JSON, and another for the partial view. But there has to be a slicker way.</p>
  
  <p>Any ideas on how best to do this?</p>