javascript - Accessing a json file from a different server with Angular (CORS) -
i need access json file located on different server (with angular). naturally no access-control-allow-origin.
these solution have tried
placing .htaccess in folder file located with.
<ifmodule mod_headers.c> <directory /var/www/app/json> <filesmatch "\.(json|jsonp)$"> header set access-control-allow-origin * header set access-control-allow-credentials true <filesmatch> </directory> </ifmodule>
the javascript looks this.
var json = $resource(url,{},{"get": { "isarray":false, "cache":false, "responsetype":"json", "withcredentials":true, "headers":{"access-control-allow-origin":"*",'content-type': 'application/json'} } }); json.get(function(data){ console.log(data); });
my issue similar this has not helped me.
Comments
Post a Comment