title: jQuery AJAX request for code igniter rest url gives bad request always
body: <p>I have a code igniter rest api. When I access the url from rest client(post man) its working fine. But when i access it from a html page(browser) it always gives 400-Bad request as a response.My ajax function code is below.</p>
  
  <pre><code>    $("#login").click(function() {
      var email = $("#email").val();
      var pass = $("#password").val();
  
      var obj = 
              {
               email: email, 
               password: pass}
  
      var jsonData= JSON.stringify( obj);
  
  
          $.ajax({
          type: 'post',
          url: 'http://www.example.com/dictionaryapi/UserController/login',
          data: jsonData,
          success: function(responseData, textStatus, jqXHR) {
              alert(responseData);
          },
          error: function(jqXHR, textStatus, errorThrown) {
              console.log(textStatus);
              console.log(errorThrown);
          }
      })
     })
  </code></pre>