Hey Martin, Thanks for bringing this to my attention - useful !
However my original question still stands: Should we be hitting api.peeringdb.com directly, or hosting our own installs for any apps we develop? Cheers /Ruairi On 11 January 2017 at 20:16, Martin J. Levy <[email protected]> wrote: > This is a JSONP issue (well worth a search on stackoverflow). Once you > master that there are no XSS errors. I also means you don't need the server > to enabled "allow origin". I had some code that works as-is. > > var url = peeringdb_api_url + '/' + $scope.getJSONParam1 + '/' + > $scope.getJSONParam2; > url = url + '?callback=JSON_CALLBACK'; > console.log('url = "' + url + '"'); > $http.jsonp(url, config) > .then(function successCallback(response) { > console.log('successCallback() called'); > $scope.getCallJSONResult = logResult("GET SUCCESS", > response.data, response.status, response.statusText, response.headers, > response.config); > }, function errorCallback(response) { > console.log('errorCallback() called'); > $scope.getCallJSONResult = logResult("GET ERROR", > response.data, response.status, response.statusText, response.headers, > response.config); > }); > }; > > This is in Angular - but that's a whole other conversation. > > Try that. > > Martin > > On Wed, Jan 11, 2017 at 11:00 AM, Ruairi Carroll <[email protected] > > wrote: > >> Hey, >> >> While writing a JS app, I noticed that Access-Control-Allow-Origin is not >> set on api.peeringdb.com. I also see that there's an open issue for >> this ( https://github.com/peeringdb/peeringdb/issues/78 ). >> >> I was wondering what would be the best way to do this - should I sync and >> host my own copy of the API, or are you OK with having random calls to the >> API from webapps? >> >> /Ruairi >> >> _______________________________________________ >> Pdb-tech mailing list >> [email protected] >> http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech >> >> >
_______________________________________________ Pdb-tech mailing list [email protected] http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
