Symfony Ajax Progress Bar Symfony Ajax Progress Bar symfony symfony

Symfony Ajax Progress Bar


You have to use session-write-close() in your long php action.

JS :

var isInProgress = false;function veryLongImport(){     isInProgress = true;     checkfx();     $.ajax({            type: "GET",            url: /myverylongueactionPath ,            async : true,            cache: false,            dataType:'html',            success: function(data){},            error: function(){  },            complete: function(){                isInProgress = false;            }        });}function checkfx(){    if( isInProgress != false )    {        $.ajax({            type: "GET",            url: /mycheckpath ,            async : true,            cache: false,            dataType:'html',            success: function(data){                 makeYourProgressBarGrowHere();             },            error: function(){  },            complete: function(){                checkfx();            }        });    } else { }}

PHP Controller:

public function myVeryLongAction($id){   session_write_close();   ... code ...}public function myCheckAction(){    ...code...}