Answer the question
In order to leave comments, you need to log in
How to make a cross domain request in MAMP?
MAMP is running
on it is running an application that is used to read the record of files
and the client application is running from another location and accesses the server through the localhost address
in all php files on the server there is a header:
just added it
but no contact
there is an error: Access to restricted URI denied
I would have done everything right
, I don’t understand where the error is and how to fix it
clearing the browser cache and reloading MAMP does not help
the feeling that php files are cached and the server uses old versions of files that do not have a header: Access to restricted URI denied
accessing the server via ajax- request
header("Access-Control-Allow-Origin: *");
var запрос = new XMLHttpRequest()
запрос.open('POST', 'скрипт.php')
запрос.setRequestHeader('Cache-Control', 'no-cache') // попробовал так и не помогло, и говорит что это устарело
запрос.send(строка)
Answer the question
In order to leave comments, you need to log in
Try using JSONP.
These are cross-domain requests using the callback function, which is predefined in the request and described in the code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question