title: CORS - Cross-Domain AJAX Without JSONP By Allowing Origin On Server
body: <p>I have two separate apps on the same server, with the EmberJS one trying to do cross-domain calls to my backend API.</p>
  
  <p>I set up my backend API to allow cross-domain requests from that specific origin. Is there a way however, to avoid using JSONP with such a set up? <code>$.ajax</code> is blocking cross-domain requests before they ever get sent. If not, what is the point of CORS, which server-side I had implemented to accept requests from my JS front-end source?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>AJAX request:</p>
  
  <pre><code>$.ajax({
      url: "api.lvh.me:3000/accounts/login",
      data: cred,
      type: "POST",
      xhrFields: {
          withCredentials: true
      },
      success: function(response){
          alert('succeeded!');
          console.log(response);
          alert(response);
      },
      failure: function(message){
          alert("failed");
          console.log(message);
          alert(message);
      }
  });
  </code></pre>