Skip to content Skip to sidebar Skip to footer

Simple Xmlhttprequest Fails With Access-control-allow-origin Header Null

I am trying to get a simple random quote from API exposed in here. It basically wants a POST request without any authorization. I want to achieve this using XMLHttpRequests. Here i

Solution 1:

You are not doing anything wrong. Your browser is expecting the API service to support CORS, but it does not. You could try to turn off CORS on your browser to help with debugging, but you should not go to production like that.

It's possible that service supports CORS's younger and weaker brother, JSONP.

If not, and if this API service is unwilling to modernize, and if there are no alternatives available to you, you'll need to make your API calls server-side.

Post a Comment for "Simple Xmlhttprequest Fails With Access-control-allow-origin Header Null"