Is not allowed by Access-Control-Allow-Origin

Hi, my code works perfectly on a local host. But the moment I upload it to my server I get this error " is not allowed by Access-Control-Allow-Origin.". Any fix for this?

Duplicate