I launch the php file, and in the browser it thinks and thinks. I work in PHPstorm, server.php and js are in the same folder. Maybe I incorrectly refer to the server.php file in AJAX?

GET http://localhost:63342/server.php 404 (Not Found) - this is displayed in the console.

  <?php header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Origin, Content-Type, Accept'); if ($_SERVER['REQUEST_METHOD'] == "POST") { $body = file_get_contents('php://input'); file_put_contents("users.json", $body); echo "OK"; } else if ($_SERVER['REQUEST_METHOD'] == "GET") { echo file_get_contents("users.json"); } 
  • The console swears that the file, in fact, no. Another way means - k0mar
  • > issues in the console to the console and PHPStorm always distributes content within the project, i.e. The server root is not localhost: 63342 /, but localhost: 63342 / MyMegaProject /. When working with a file, browser icons should appear in the upper right corner, which will open this file in the browser by pressing. - etki
  • doesn't work anyway ( - Sergey74rus
  • maybe the problem is in php code? because even server.php doesn’t load separately - Sergey74rus
  • @Sergezha Sukhinin, according to the diagnosis, "does not work" without details it is very difficult to say anything. - etki

0