0

So, I'm sending a form with ajaxForm which will send data, open spinner.gif, then on success close spinner and reload the page:

$('#form').ajaxForm({
beforeSubmit:function(){
    spinnerLoad();},
success: function(data){
    spinnerDone();      
    window.location.href ="sample.php";
}
});

Then the form is handled like this:

if (isset($_POST['save'])){
  exec("/directory/script.php $args");
}

So this page, 'script.php' executes another script on DB, so it may take a long time. When there is not many data, it works fine, but whenever I have much, after a time 'script.php' wents 404, and the spinner.gif never stops.

I need to find a way to extend timeout somehow (ajax timeout option seems not suitable) or another way. Sending the script.php page or the DB script to background is not ok - it must be finished in order to continue working.

I'll be glad to any comments/directions to look.

it4Astuces
  • 432
  • 5
  • 17
amelie
  • 289
  • 3
  • 16
  • https://stackoverflow.com/questions/5225597/set-timeout-for-ajax-jquery try this – weegee Feb 04 '19 at 12:12
  • *"ajax timeout option seems not suitable"* - Why not? Isn't extending the timeout *exactly* what you want to do? – David Feb 04 '19 at 12:14

0 Answers0