title: Not able to pass ajax post request to register controller in asp.net mvc
body: <p>I need to pass the ajax post request to register controller in asp.net mvc, but it's throwing an error.</p>
  
  <pre><code>$('#btnRegister').click(function () {
                  var model = new Object();
                  model.Email = $('#signup_email').val();
                  model.Password = $('#signup_password').val();
                  model.ConfirmPassword = $('#signup_confirm_password').val();
                  $.ajax({
  
                      url: 'api/Account/Register',
                      method: 'POST',
                      contentType: "application/json",
                      data: JSON.stringify(model),
                      success: function () {
  
                          $('#successmodal').modal();
                      },
                      error: function (jqXHR) {
                          $('#divErrorText').text(jqXHR.responseText);
                          $('#divError').show('fade');
  
                      }
                  });
  
  
              });
  
          });
  </code></pre>
  
  <p>Below is by default mvc register controller</p>
  
  <pre><code>// POST api/Account/Register
          [AllowAnonymous]
          [Route("Register")]
          public async Task&lt;IHttpActionResult&gt; Register(RegisterBindingModel model)
          {
              if (!ModelState.IsValid)
              {
                  return BadRequest(ModelState);
              }
  
              var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
  
              IdentityResult result = await UserManager.CreateAsync(user, model.Password);
  
              if (!result.Succeeded)
              {
                  return GetErrorResult(result);
              }
  
              return Ok();
          }
  </code></pre>
  
  <p>Modal is showing invalid model object passed.<a href="https://i.stack.imgur.com/HAnMI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HAnMI.jpg" alt="enter image description here"></a></p>