No ‘Access-Control-Allow-Origin’ header is present on the requested resource
При ошибке
Access to XMLHttpRequest at 'https://site1.ru/api.php' from origin 'https://site2.ru' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
добавить на отдающий данные сайт (в примере site1.ru) заголовок
header('Access-Control-Allow-Origin: *');