Re-reading your original question :- for ($x=1; $x<=10; $x++) { call to a AJAX function which would call a php file on server iterate to next when a response is received if there is some error, connection error or something like that i need to get that error and then go for next iteration. } It looks like you don't need to use AJAX at all. If I understand this correctly, you want the PHP program to write an AJAX function, that will call a PHP page from a server. Why don't you just get the PHP page to call the PHP page, instead of relying on the client to do it? You can use something like http_get() - http://uk3.php.net/manual/en/function.http-get.php - for this. If the file is local to your web server, then you could simply use include(). Rob. -----Original Message----- From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Shaikh Md. Zaid Sent: 13 March 2007 12:24 To: php-objects@xxxxxxxxxxxxxxx Subject: RE: Synchronous call with AJAX? Hi Robert, Your suggestion is good but our problem is that we are using our own framework for AJAX we cannot change it. Can we wait till a response is received from the server. Regards, Zaid *********************************************************************************** Any opinions expressed in email are those of the individual and not necessarily those of the company. This email and any files transmitted with it are confidential and solely for the use of the intended recipient or entity to who they are addressed. It may contain material protected by attorney-client privilege. If you are not the intended recipient, or a person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited. Random House Group + 44 (0) 20 7840 8400 http://www.randomhouse.co.uk http://www.booksattransworld.co.uk http://www.kidsatrandomhouse.co.uk Generic email address - enquiries@xxxxxxxxxxxxxxxxx Name & Registered Office: THE RANDOM HOUSE GROUP LIMITED 20 VAUXHALL BRIDGE ROAD LONDON SW1V 2SA Random House Group Ltd is registered in the United Kingdom with company No. 00954009, VAT number 102838980 ***********************************************************************************