Has anyone ever heard of CORS when using api or Ajax?

Every time i try using a api or ajax i get this error in my google chrome console “No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.” idk what to do?

This comes up a lot on the forum!

Start here:

Holler if you need more direction :slight_smile:

1 Like

So instead of Json i have to use Jsonp from now on?

Not necessarily. It depends how the server you are communicating with is set up.

API providers usually have documentation that tells you how to work with their API end points. You should always read these first, because they have different expectations about the headers or query parameters you need to send.

Are you writing in CodePen? Can you link to the code you’re working on now?

Most (but not all) servers are going CORS compliant these days, so your JSON skills will still serve you well. JSONP is a thing, but I suspect will not be very much longer.

thanks for help guys i had a friend fix it he basically said the same things u guys did