title: POSTing data return error instead of success
body: <p>I am new to Spring MVC and I am trying to send my data to Spring-MVC Controller using AJAX, on button click. I have written this code (given below) but I am getting error instead of success. please tell what can be the issue?</p>
  
  <p><strong>AJAX:</strong></p>
  
  <pre><code>function add() {
                  var name   = $('#name').val();
                  $.ajax({
                      url : "/addUser",
                      data : name,
                      type : "POST",
                      async: false,
                      success : function(response) {
                          alert( response );
                      },
                      error : function() {
                          alert("error....");
                      }
                  });
              }
  </code></pre>
  
  <p><strong>JAVA</strong></p>
  
  <pre><code>@RequestMapping(value = "/addUser", method = RequestMethod.POST)
     public String addUser(@ModelAttribute("UserTest") String name) {
        //task
        return name;
     }
  </code></pre>