JQuery problem with timeout -


I have found a problem with the jQuery timeout experiment, I have a page with a script, it is a timeout set and Waiting for the response from the server. The problem occurs when the time is up, in less words, it is "no action", I think the script does not interrupt the connection with the server and the server waits for the response, because the connection in server side 10 Is for seconds (but timeout is set to 5 seconds). I see this problem when the client works in different domain names, while the server and the client work in this problem if the server does not work.

Do you have an idea because this error occurred or how to close the script connection?

  // $ client AJAX ({type: "GET", url: "some.php", data: "name = John and location = Boston", timeout: 5000, success: function (msg) {warning ("data saved:" + msg );}, Error: function (request, error type, instant instant) {warning ("opppsssss ....");}});  

and server code:

  // some.php < ? // Long-term sleep emulation (10); // sleep 10 seconds // send feedback "echo some test data"; ? & Gt;  

Best Relationship

Dominico

You are backing it by looking at it. You have set the timeout to 5000 milliseconds (5 seconds), so if the server-side code takes longer than 5 seconds to respond, then it will expire. You are sleeping (10); Which sleeps for 10 seconds, which is twice the specified timeout form. Here's how to fix this:

  // $ client $ AJAX ({type: "GET", url: "some.php", data: "name = John & amp;; WARNING: function (request, error type, instant instant) {warning (" opppsssss .... ", "Location = Boston", timeout: 10000, success: function (msg) {warning ("data saved:" + msg);});}});  

and server code :

  // some.php  

Hope this helps.


Comments