On the server to an ajax request?

Good day dear programmers. There are 2 app directory and public in the file .htaccess asked that all requests went to public/index.php How modern frames transmit an ajax request to the server because I can't get access to app/controllers/NewsController.php and templates. Can only write JSON for example to the folder public api.json and then display on the client. Well I need somehow to pass from the client to the server in either json get, post but without the full path to the files is there any superglobal variables like $_GET, $_POST to read the ajax and send json? Without ajax everything works fine connect the controller and action called api but history all the spoils to the php renders templates(
March 19th 20 at 09:17
1 answer
March 19th 20 at 09:19
Solution
So make a separate route under the IPA. To have all requests to a single controller which will have to see what method you need and run it

Find more questions by tags JSONJavaScriptPHPAJAX