title: passing model from controller to view with jQuery Ajax
body: <p>I want to pass model from controller to view with jQuery ajax on button click. I have data on server side but jQuery ajax returns this error:</p>
  
  <p>'Failed to load resource: the server responded with a status of 500 (Internal Server Error)'</p>
  
  <pre><code>` $.ajax({
          url: '@Url.Action("userData", "Account")',
          type: 'post',
          dataType: 'json',
          contentType: 'application/json; charset=utf-8',
          success: function (data) {
              Do Something
          },
          error: function ( error) {
             alert(error.Message);
          }
     });
  
      [HttpPost]
      [Authorize]
      public ActionResult userData()
      {
          var _userData = db.userInfos.ToList();
          var result = new
          {
              MyUserData= _userData 
          };
          return Json(result, JsonRequestBehavior.AllowGet);
      }
  </code></pre>