API Access Control Check : <p>I'm accessing an external API from Javascript in my app and I get this error:</p>

<p>Failed to load <a href="http://www.myapp.com//api/v1/syndication/categories?output=json" rel="nofollow noreferrer">http://www.myapp.com//api/v1/syndication/categories?output=json</a>: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://local.myapp.com" rel="nofollow noreferrer">http://local.myapp.com</a>' is therefore not allowed access. The response had HTTP status code 400.</p>

<pre><code>    function MakeAPIRequest(requestUrl, requestData, callback) {

    $.ajax({

        beforeSend: function(xhr){
            xhr.setRequestHeader('Access-Control-Allow-Origin', 'http://local.myapp.com'); 
            xhr.setRequestHeader('Token', apiKey); 
        },
        type: "GET",
        url: requestUrl,
        data: requestData,
        dataType: "json",
        success: function(json){
            callback(json);
        }

    });

}
</code></pre>

<p>Could be the API doesn't accept an "OPTIONS" request?
This is the server response:</p>

<p>{"error":"Bad Request -  Only accepts get requests","code":1009}</p>
