Love Calculator

FREE
By Ajith Joseph | Updated 19日前 | Entertainment
Popularity

9.7 / 10

Latency

462ms

Service Level

97%

Health Check

N/A

Back to All Discussions

AngularJS $http & $resource

Rapid account: Morticai
morticai
9年前

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!

Rapid account: Ajith
ajith Commented 9年前

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

Rapid account: Morticai
morticai Commented 9年前

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>

Join in the discussion - add comment below:

Login / Signup to post new comments