index.файл и php-скрипт и папка "данные" лежат в корне
XMLHttpRequest cannot load
Cross origin requests are only supported for HTTP
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load
var запрос = new XMLHttpRequest();
запрос.open('POST', 'сканировать_домен.php');
запрос.setRequestHeader("Content-Type", "text/plain; charset=UTF-8");
запрос.onreadystatechange = function()
{
if(запрос.readyState === 4)
{
alert(запрос.responseText.JSONparse)
};
};
запрос.send("path=/данные/");
<?php
$dir = scandir($_REQUEST['path']);
echo json_encode($dir);
?>