There is a php script that accesses the API and receives data from it for 5-10 seconds. Is it possible to somehow load this data as it is received on the client via ajax?

    1 answer 1

    Ajax works on a request-response system, so it’s not possible to receive data partially while php is running.

    For a similar case, long requests did so.

    1. Asynchronous ajax to the heavy php script.
    2. This script writes the result to a file on the server.
    3. Meanwhile, ajax is launched every 2 seconds on a timer to read this file and refresh the page.