views:

277

answers:

2

I have an existing signup form that submits in the traditional (non-ajax) way. I want to splice in some Javascript so that I can use some of the data from this form to populate other fields in another database. If this insertion takes a significant amount of time (one minute) is the page going to be locked until the AJAX call returns?

<script language="javascript">
$(document).ready(function(){   
    $("#setupform").submit(function(){
     doAJAXcallHERE();
    });
});
</script>

Basically, do is my webpage going to grind to a halt if the PHP page called by the AJAX function takes over a minute to process?

Thanks!

+1  A: 

If the request is going to take more than a couple of seconds, you should probably:

  • Disable the Submit button after the call is made so they don't try resubmitting the form again and again.
  • Display some sort of message on screen informing them that their request is being processed, asking them to hang on in there!
  • Display some sort of animated indicator along with the message.

Those last 2 points in particular will ensure that the user is aware that something happening behind the scenes. Also, if you're expecting the request to take long, make sure your Web server timeout settings are adjusted accordingly.

Barry Gallagher
A: 

already answered correctly but i would like to add some more... on php page, you need to use set maximum execution time via set_time_limit(0). your ajax submitting script must be optimized well. Especially IE6 has many problems while submitting file & post data with ajax. if you use weird technics (i use often) you may need to change your script to a simple 1. sometime ago i had a problem with IE6 just like yours. browser was blocking itself. just because an array definition for serializing several radio buttons. all other browsers work well with the script but IE6 stops, waits & waits... even if IE7 was working perfect.

btw, it seems you are using Jquery... i advice you to use jquery blockui plugin at malsup.com. also you need to inform your visitor/client to wait.

risyasin