Newer Version Available
Using the Timeout Parameter with Asynchronous Calls
If necessary, you can specify a maximum timeout for an
asynchronous call with AJAX Toolkit.
If an asynchronous call does not complete in an appropriate amount
of time, you can end the call. To do this, specify the timeout parameter in the callback
section of any asynchronous call:
1var account = new sforce.SObject("Account");
2account.Name = "my new account";
3
4sforce.connection.create([account], {onSuccess: print, onFailure: printerr, timeout: 100});Values for this parameter are in milliseconds, and valid values are integers beginning with 1.
If the call is successful within the time specified by the callout, no additional actions are taken. If the call is not successful, the onFailure action is performed.