2

i creat android app that work whit my site whit json api .but i have one problem in my browser; my cod in app.js is:

$http.get('http://api.geosvc.com/rest/US/84606/nearby?apikey=4ff687893a7b468cb520b3c4e967c4da&d=20&pt=PostalCode&format=json')
.success(function(response){
  angular.forEach(response.data.children,function(child){

  $scope.stories.push(child.data);

  });

and this is my problem in chrome:

XMLHttpRequest cannot load htttp://api.geosvc.com/rest/US/84606/nearby?apikey=4ff687893a7b468cb520b3c4e967c4da&d=20&pt=PostalCode&format=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.1.38:8100' is therefore not allowed access. ?ionicplatform=ios:1

pleas help... :)

2 Answers 2

0

Try to read about CORS.

This is a good start for Ionic.

It is recommended that you implement the solution in your backend.

Only for testing purpose you can use the CORS plugin in Chrome app store and enable it, to make the requests work.

Sign up to request clarification or add additional context in comments.

Comments

0

Please check this stackoverflow answer.

It explains about simple CORS requests and preflight CORS requests sent by angular, to obtain data.

Hope it helps you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.