bike5;10998563 wrote:I don't want to too fast in-case someone using dial-up takes say 5 seconds to load a request
Well wait a minute - what type of timeout are we talking about? Are we talking about a connection timeout, e.g. your AJAX code sends an HTTP request but doesn't receive a reply of any sort after X seconds? Or are we talking about a total response timeout, e.g. even if server responds to the HTTP request but transmits the body of the response too slowly (e.g. after 15 seconds, you're still getting bytes coming in as part of the original response)?
bike5;10998563 wrote:I have a quiz that loads questions 1 by 1 via ajax
Why not store all of the questions in a JSON-encoded array-like structure of some sort and just send them all in one go? That would cut down on the overhead of multiple HTTP requests/responses quite a bit, and would probably help improve the reliability/stability issues you're seeing (rather than needing 20/20 requests to all work, you only need a single successful attempt).
bike5;10998563 wrote:I guess I would rather side on longer then shorter because I don't want "valid" slow connections hitting an infinite loop of re-ques because there slow connection keeps getting timeouts.
In that case, you could get a bit fancy and come up with a dynamic timeout scheme.
For example, set an array of timeout values in increasing magnitude (example: 2 secs, 3 secs, 5 secs, 10 secs, 15 secs, 20 secs) and start with the smallest timeout value. When you hit a timeout condition, increment a "next timeout value" pointer to the next highest timeout value.
You could then expand it even further to start decrementing the timeout pointer once you start getting successful responses with no timeouts.