title: jquery ajax post says xxx not allowed by Access-Control-Allow-Origin
body: <p>I was trying to call eBay FindProducts API using AJAX (<code>post</code> request) but was stuck at the following error:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://open.api.ebay.com/shopping?callname=FindProducts" rel="nofollow">http://open.api.ebay.com/shopping?callname=FindProducts</a>. Origin <a href="http://localhost.com/test.php" rel="nofollow">http://localhost.com/test.php</a> is not allowed by Access-Control-Allow-Origin.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>$.ajax
  ({
      type: "POST",
      url: 'http://open.api.ebay.com/shopping?callname=FindProducts',
      dataType: ($.browser.msie) ? "text" : "xml",
      contentType: 'application/x-javascript',
      crossDomain : true,
      data: {
          'X-EBAY-API-APP-ID' : 'ebayAppId', 
          'X-EBAY-API-VERSION': '771', 
          'X-EBAY-API-SITEID': '0', 
          'X-EBAY-API-REQUEST-ENCODING': 'NV', 
          'X-EBAY-API-RESPONSE-ENCODING': 'json',
          'QueryKeywords' : '753759971632',
          'MaxEntries' : '3'
      },
      success: function (result) {
          alert('success');
          alert(result);
      },
      error: function (data) {
          alert((data));
      }
  })
  </code></pre>
  
  <p>How can I get through this error.</p>
  
  <p>I tried setting <code>dataType : jsonp</code> (I know XML is being retrieved, but to workaround the error I set it to jsonP). It works but jQuery was unable to parse the XML as the json response was expected.</p>