Ajax: multiple requests

English | Links | XHTML | js/ajax - 18/02/2006 @ 19:07



From IBM ajax tutorial:

When 0 is equal to 4
In the use case where multiple JavaScript functions use the same request object, checking for a ready state of 0 to ensure that the request object isn’t in use can still turn out to be problematic.

Since readyState == 4 indicates a completed request, you’ll often find request objects that are not being used with their ready state still set at 4 — the data from the server was used, but nothing has occurred since then to reset the ready state.

There is a function that resets a request object called abort(), but it’s not really intended for this use. If you have to use multiple functions, it might be better to create and use a request object for each function rather than to share the object across multiple functions.


Tags: , , , ,

2 Responses to “Ajax: multiple requests”

livanNo Gravatar says on

yeah, but how about
the function which handle the onreadystatechange event ?
do we create multiple function too?
instead of sharing a function ?
thx before..

PS:coz you said that we must create
multiple request object(such as XMLHttpRequest)

Livan – Indonesia

BaldoNo Gravatar says on

you can share the function, livan

Commenta | Leave a Reply

CommentLuv Enabled
***