Hello, I’m trying to use your API.
However I’m getting the error:
XMLHttpRequest cannot load https://love-calculator.p.mashape.com/getPercentage. The request was redirected to ‘https://love-calculator.p.mashape.com/user/errorpage?aspxerrorpath=/mashape/lovetest.aspx/getPercentage’, which is disallowed for cross-origin requests that require preflight.
Even though I’m changing the headers to application/json it still appears to be sending back the data as xml.
Any help would be great thanks!
Join in the discussion - add comment below:
Hi,
Something is technically wrong. Thanks for noticing — we’re going to fix it up and have things back to normal soon.
Thanks and regards
Ajith
Ended up figuring out the issue.
Here is the code if anyone else is trying to use this API with Angular JS $http warpper.
<pre><code>
var req = {
method: ‘GET’,
url: ‘https://love-calculator.p.mashape.com/getPercentage?fname=nameone&sname=nametwo’,
dataType: ‘json’,
headers: {
‘Accept’: ‘application/json’,
‘X-Mashape-Key’: ‘YOU-API-KEY’
},
};
$http(req).success(function(data) {
$scope.data = data;
console.log(data);
});
};
</pre></code>