V
V
VladBokov2020-04-16 21:13:14
PHP
VladBokov, 2020-04-16 21:13:14

How to respond to ajax request in php during a loop?

Please tell me how to implement the task:
There is an ajax request from the front to the back. I send the parameters to php, and he, in turn, makes the necessary calculations in a cycle.
Previously, when I needed to get one response, I wrote a variable with the value of the completed result to die () and ajax in success received this response and worked further with it in the front.
I need that during the execution of a loop in Php, after each iteration, ajax receives the response of performing calculations in the iteration and sends the result sequentially to success. What to use instead of die()?
This is necessary to display the progress of the process.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2020-04-16
@inoise

websocket. Or to reconsider interaction with the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question