ucdd2-sp15 / announcements

Issues as the course mailing list for announcements
1 stars 1 forks source link

XMLHttpRequest cannot load #18

Open zhya215 opened 9 years ago

zhya215 commented 9 years ago

Hi folks, we got a problem about XMLHttpRequest, this is the error we got: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 404.

Anyone got the same problem?

peymanmortazavi commented 9 years ago

Are you trying to get response from yelp? They don't support CORS, so what happens is, your browser will first send a request with http method 'OPTIONS' to see if your domain has permission, if successful, it will then send your request. Yelp doesn't support CORS so they don't respond to OPTIONS requests and thus no matter what, you'll always get that error. I suggest that you use your own backend.

zhya215 commented 9 years ago

I used, it still didn't work

On Thursday, February 26, 2015, Peyman Mortazavi notifications@github.com wrote:

Are you trying to get response from yelp? They don't support CORS, so what happens is, your browser will first send a request with http method 'OPTIONS' to see if your domain has permission, if successful, it will then send your request. Yelp doesn't support CORS so they don't respond to OPTIONS requests and thus no matter what, you'll always get that error. I suggest that you use your own backend.

— Reply to this email directly or view it on GitHub https://github.com/ucdd2-sp15/announcements/issues/18#issuecomment-76315604 .

peymanmortazavi commented 9 years ago

give me the url, I'll check on it. your back-end should allow cors, if you're using express. use "cors" for express to enable cross origin resource sharing, you may want to allow all domains.

peymanmortazavi commented 9 years ago

you can use mine. it supports CORS. https://agile-woodland-5195.herokuapp.com/v2/search?term=food&location=San+Francisco