Access-controll-allow-origin is not allowed


#1

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 ?


#2

Hi

did you try with jsonp?


#3

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


#4

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

Here you can read more about this.