I have this ajax request to update my db.
function ajax_submit(){ var submit_val=$("#stato").serialize(); dest="plan/new_bp1.php"; $.ajax({ type: "POST", url: dest, data: submit_val, success: function(data){ data1=data.split("|"); if(data1[0]=="Successo"){ $("#spnmsg").fadeTo(200,0.1, function(){$(this).removeClass().addClass("spn_success").html(data1[1]).fadeTo(900,1)}); }else if(data1[0]=="Errore"){ $("#spnmsg").fadeTo(200,0.1, function(){$(this).removeClass().addClass("spn_error").html(data1[1]).fadeTo(900,1)}); } }, complete: function(){ setTimeout(function(){ $('.container').load('plan/home.php');},2000); } }); } The called script will take long to perform since it has to select, elaborate and insert around 4.000 recors each time. What I do now is to add a spinner on the screen to give users a feedback that the request is working (triggered by AjaxStart and AjaxStop).
At the end of the call the complete function will echo what the php script will echo.
What I'd like to do is to have a counter that will update during the script execution where I can say something like "X records out of 4.000 processed" On the script side I have no problem to calculate the number of processed records and the number of record overall. How can I update my script to show the progress?
progresshandler for something like this.progressthat could help me ;)