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

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

#1

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?


#2

This comes up a lot on the forum!

Start here:

Holler if you need more direction :slight_smile:


#3

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


#4

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.


#5

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


#6

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.


#7

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