D
D
DiaTMss2019-03-30 14:56:10
PHP
DiaTMss, 2019-03-30 14:56:10

How to get an ajax request on the server?

Good day dear programmers. There are 2 directories app and public in the .htaccess file so that all requests go to public/index.php I can only write JSON in the public api.json package and then display it on the client. Well, I need to somehow transfer from the client to the server in json or get, post, but without the full path to the files, are there superglobal variables like $_GET, $_POST to read ajax and send json? Without ajax, everything works fine, the controller is connected and the action is called, but the history api spoils everything php does not render templates (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2019-03-30
@DiaTMss

So make a separate route for api. So that all requests to a separate controller that will already look at what method you need and run it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question