Stockvider end of day historical data

FREE
By Stockvider | Updated 5 giorni fa | Finance
Health Check

N/A

Back to All Discussions

CORS error with AJAX request

Rapid account: Stockvider
Stockvider
8 anni fa

You may get a CORS error when accessing the API through your localhost. As an example :

$.ajax({ “async”: true, “crossDomain”: true, url: ‘https://stockvider.p.mashape.com/indicator/DATA/AAPL’, type: ‘GET’, data: {}, dataType: ‘json’, success: function (data) { console.dir((data.source)); }, error: function (err) { console.log(err); }, beforeSend: function (xhr) { xhr.setRequestHeader(‘X-Mashape-Key’, ‘XXX’); } });

Ariel

Rapid account: Stockvider
Stockvider Commented 8 anni fa

CORS is fully enabled now. You no longer need to use JSONP.

Ariel

Rapid account: Stockvider
Stockvider Commented 8 anni fa

It seems that Mashape redirection is causing troubles but we are not 100% sure. However we can provide a workaround.

You can directly access our API while bypassing Mashape (http://api.stockvider.com/). Here is the correct Ajax request (the dataType has to be jsonp) :

$.ajax({ “async”: true,
“crossDomain”: true,
url: ‘http://api.stockvider.com/indicator/DATA/AAPL’,
type: ‘GET’,
data: {},
dataType: ‘jsonp’,
success: function (data) { console.dir((data.source)); },
error: function (err) { console.log(err); },
});

Ariel

Join in the discussion - add comment below:

Login / Signup to post new comments