title: Converting cURL to jQuery AJAX
body: <p>I'm trying to make an API call with jQuery AJAX using curl as given to me by the backend team. </p>
  
  <pre><code>curl -X POST \
    https://example1.com/api/sms \
    -H 'Accept: application/json' \
    -H 'Cache-Control: no-cache' \
    -H 'Content-Type: application/json' \
    -H 's: APP' \
    -d '{ 
     "mobile": "1110002222"
   }'
  </code></pre>
  
  <p>But it is throwing a 403 forbidden error:</p>
  
  <pre><code>Invalid CORS request
  </code></pre>
  
  <p>This is the code hosted on another domain name (example2.com):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>data = {mobile: '0001112222' };
  success = function(data) { console.log(data); };
  headers = {s: 'APP'};
  $.ajax({
   type: 'POST',
   url: 'https://example1.com/api/sms',
   data: data,
   success: success,
   dataType: 'json',
   headers: headers
   });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What am I doing wrong or missing? </p>