Access to XMLHttpRequest at ...has been blocked by CORS policy

Hi,

have a script on another server that is being called via ajax, receiving:

Access to XMLHttpRequest at ‘http://192.168.0.150/xxxx.php?c=5&t=9’ from origin ‘http://localhost’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

on the remote server and local server, I set the .htaccess:

Header set Access-Control-Allow-Origin ‘http://192.168.2.18
Header set Access-Control-Allow-Origin ‘http://localhost

the error showing for the listpage (damscampaignslist) that i’m calling the curl/ajax script from.

but it continues to display the error, but the script ran successfully.

via Microsoft Edge, the call ran successfully with no CORS error.

thanks,
JS

If you have added the two line in the same htaccess, dont think is allowed…

I replaced temporarily with
Header set Access-Control-Allow-Origin “*”
don’t understand why this isn’t working. htaccess if is in same directory where this script is…

if I run the url from the browser:
http://192.168.0.150/xxxxxxxxxxxxx/daemons/script.php… it executes without returning an error.
through the ajax call… it executes correctly, but returns data.statusText =“error”

can this be be added into the header somehow via the code?

and in the network debug, the headers returned:

Request URL

http://192.168.0.150/xxxxx/daemons/script.php?c=5&t=

Request Method GET
Status Code 200 OK
Referrer Policy strict-origin-when-cross-origin