0

I have a .php script on my azure server which returns JSON. When you visit the link in your browser, it shows you the JSON.

I want to make an ajax call to this script, but none of my ajax calls to the server get through. I have no idea why.

webpage that executes a failed ajax call to the .php script

Could it have something to do with cross-domain ajax calls?

Ruben
  • 441
  • 5
  • 14

1 Answers1

0

I've found the solution here: origin-is-not-allowed-by-access-control-allow-origin ...

It's the browser who is blocking cross-origin ajax calls. You can overcome this by allowing your script to receive ajax calls from every domain by adding this to your script header:

C#:

Access-Control-Allow-Origin: *

php:

<?php header('Access-Control-Allow-Origin: *'); ?>
Community
  • 1
  • 1
Ruben
  • 441
  • 5
  • 14