Access-controll-allow-origin is not allowed

hello guys
im using $http to get a json file but when i view it by console.log() throw me following error :

XMLHttpRequest cannot load http://www.example.com/api.json. Origin http://localhost:8100 is not allowed by Access-Control-Allow-Origin.

i followed this post [http://blog.ionic.io/handling-cors-issues-in-ionic/](cors issue) to use proxy but it give me 404 error!!

can anyone help me ?

Hi

did you try with jsonp?

1 Like

thanks.its worked by using $http.jsonp(), but why it does not work with $http.get() ?!

Maybe because you are trying to reach some some domain that does not allow cross domain.

Here you can read more about this.

1 Like