title: Calling WCF service from jQuery Ajax using POST method
body: <p>I have a following WCF method </p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", UriTemplate = "UserService/AddUser", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
  public User AddUser(string LoginId, string Name)
  {
      var user = input;
  
      // Some business logic here
  
      return user;
  }
  </code></pre>
  
  <p>And I have a jQuery Ajax client code as below</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
  
          $("#submit").click(function () {
              var input =
              {
                  LoginId: $("#LoginId").val(),
                  Name: $("#Name").val()
              };
  
              $.ajax({
                  cache: false,
                  type: "POST",
                  async: false,
                  url: "http://localhost:2000/UserService/AddUser",
                  data: JSON.stringify(input),
                  contentType: "application/json",
                  dataType: "json",
                  success: function (userViewModel) {
                      var user = userViewModel;
                      alert(user);
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Once ajax invoke AddUser method LoginId and Name value is set in AddUser method's two parameter, however, What I want to do is having a method signature as below</p>
  
  <pre><code>public User AddUser(User user)
  </code></pre>
  
  <p>Of course, User class have LoginId and Name properties in it.</p>
  
  <p>How to bind client's parameter to user instance automatically without setting the value manually?</p>