You should 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... }
source share