I have created a CORS request from my .aspx page. My Ajax request as follows.
$.ajax({
method: 'POST',
url: "https://api.kraken.io/v1/url",
data: JSON.stringify('{"auth": {"api_key:"' + api_key + '","api_secret:"' + API_Secret + '"},"url:"+ "http://test.pw.com/ScreenShots/3C65B6.jpg","callback_url:"+ "http://test4.pw.com/Admin/TaskAndProjectSearch.aspx","json": true}'),
crossDomain: true,
beforeSend: function (xhrObj) {
xhrObj.setRequestHeader("Content-Type", "application/json");
},
success: function (result) {
console.log(result.d);
},
error: function (req, status, error) {
}
});
I am using IIS8 and I have enabled CORS by adding following to web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Access" />
</customHeaders>
</httpProtocol>
</system.webServer>
Still I got the following error . XMLHttpRequest cannot load url. Response for preflight has invalid HTTP status code 404 . Have anyone got any idea about this.I need this to be fixed as soon as possible. Please help. Thanks in advance