0

I am trying to access financial statements from edgar-online. This is my GET request:

var edgarresults = new Array();
edgardata = ['aapl','msft']
for(j=0; j<edgardata.length; j++){
var url1='http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=edgaronline.api.mashery.com%2Fv1%2Fcorefinancials%3Fprimarysymbols%3D';
edgarresults.push( $.getJSON(url1, edgardata[j] +'%26conceptGroups%3DBalanceSheetConsolidated%26debug%3Dfalse%26sortby%3Dprimarysymbol%2Basc%26appkey%3Dh9f7er3s78ypqyytqebrjeys')
.done(function (results1) {
edgarresults.push(results1);
   console.log (results1);
    })
    .fail(function (jqxhr, textStatus, error) {
    var err = textStatus + ", " + error;
    }) );
}

when you paste the url in the chrome address bar or test it on DHC client (google chrome extension), the output is nicely formatted json data. Here is the url: http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=edgaronline.api.mashery.com%2Fv1%2Fcorefinancials%3Fprimarysymbols%3Dmsft%26conceptGroups%3DBalanceSheetConsolidated%26debug%3Dfalse%26sortby%3Dprimarysymbol%2Basc%26appkey%3Dh9f7er3s78ypqyytqebrjeys/

I am not sure how the get request is not being processed. I keep getting the no access control allow origin error.

neesop
  • 49
  • 6
  • Doesn't http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource or http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-access-control-allow-origin help? – JP Moresmau Apr 10 '15 at 19:58
  • I don't have control of the server so I can't set Access-Control-Allow-Origin: *. Also, I tried using '$.ajax({' but keep getting No access control allow origin! – neesop Apr 10 '15 at 20:03
  • It's your browser that prevents it: one page in one domain cannot by default access data from another via a script. Check the top answer in the first link above, it has a link to a helpful article: http://www.html5rocks.com/en/tutorials/cors/ – JP Moresmau Apr 10 '15 at 20:05

0 Answers0