imperium2335 imperium2335 - 4 months ago 12x
Ajax Question

AJAX live feed from PHP

Is there a way to have an ajax script make updates to a html element while the PHP script is being parsed and not only when it has completed? I.e.:


echo 'stage 1';
echo 'stage 2';
echo 'Finished';

What I would hope to see happen to the html element is that first it says 'stage 1', then 3 seconds later, 'stage 2' etc.

Would flushing the OB achieve what I want or is there a better way of doing this?


Sorry but to you can do this you need create this logic on the front-end with javascript/jQuery and use only back-end(php) to get the feeds.

    //jQuery code..
        url: 'url_to_get_feeds',
        data: {}, //if need put some param on request
        success: function(callback){
            //logic to put call content to html
            //callback recive all content gerenated on the page 'url_to_get_feeds'