title: The request sent by the client was syntactically incorrect
body: <p>I am trying to call my Spring MVC controller from a JSP (I-Frame) and getting the following error on the browser</p>
  
  <pre><code>400 Bad Request,The request sent by the client was syntactically incorrect ()
  </code></pre>
  
  <p>here is my JQuery code to send request to the server</p>
  
  <pre><code>jQuery("#login").live('click', function(e) {
          e.preventDefault();
             jQuery.ajax({
              url: "https://localhost:9002/myApp/springSecurity/login.json",
              xhrFields: {
                     withCredentials: true
                  },
              type: "POST",
              crossDomain:true,
              data: jQuery("#loginForm").serialize(),
             contentType: "json",
  
              success: function(data, status) {
                  alert(data);
                  alert(status);
                  if (data.loggedIn) {
                     // location.href = getHost() + '${ctx}/users';
                      //login_pannel
  
                  } else {
                      loginFailed(data);
                  }
              },
              error: loginFailed
          });
  
      });
  </code></pre>
  
  <p>This is my controller code</p>
  
  <pre><code>@Controller
  @RequestMapping("springSecurity/login.json")
  public class SpringSecurityLoginController
  {
  @RequestMapping(method = RequestMethod.POST)
  @ResponseBody
  public SpringSecurityLoginStatus login(@RequestParam("j_username") final String username,
  @RequestParam("j_password") final String password, final HttpServletRequest request, final HttpServletResponse response)
      {
  
      LOG.info("Starting login process");
      return springSecurityLoginService.login(username, password, request, response);
      }
  }
  </code></pre>
  
  <p>While hitting the submit button i am getting no error on the server but while looking at browser console output it showing me the following error</p>
  
  <pre><code>"NetworkError: 400 Bad Request - https://localhost:9002/myApp/springSecurity/login.json"
  </code></pre>
  
  <p>This is Error information from Mozilla Response header</p>
  
  <pre><code>the request sent by the client was syntactically incorrect ().
  </code></pre>
  
  <p>I am not sure what causing this behavior.
  Additionally i am using Spring security to handle authentication and authorization.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I debugged more and find out that the form values are not being submitted to my controller when i checked the value of <code>j_username</code> and <code>j_password</code> in my Controller tey are coming as null.</p>
  
  <p>i even tried <code>request.getParameter("param name");</code> but still same values are coming as null</p>