title: ASP MVC Ajax and model rebinding
body: <p>I have this action method:</p>
  
  <pre><code>[HttpPost]
  public ActionResult GetNextImage(int m_id)
  {
       ...
       return Json(new{...});
  }
  </code></pre>
  
  <p>I invoke it like this:</p>
  
  <pre><code>$(function () {
          $('#nextImage').submit(function () {
              $.ajax({
                  url: this.action,
                  type: this.method,
                  data: "m_id=" + $('#img').attr('alt'),
                  success: function (result) {
                      $('#img').attr("src", result.imagePath);
                      $('#img').attr("alt", result.ImageId);
                  }
              });
              return false;
          });
      });
  </code></pre>
  
  <p>I have Image object</p>
  
  <pre><code>public class Image
  {
      public int ImageId {get;set;}
      public string imagePath {get;set;}
      public List&lt;Comment&gt; Comments {get;set;}
  }
  </code></pre>
  
  <p>Now. Is it possible to return from action method my "Image" object and bind it?<br/>
  I don't know how to load list of comments with JSon. Thats why I want to return object and with simple loop to display all comments. But I don't know how to return object from action method and bind it to (razor) page.</p>