DigitalBonsai

Shaping the Web

Happiness is in the doing.

Multiple XHR requests (AJAX)

This is testing multiple AJAX requests at the same time. A problem I've been having with the AJAX request is that there was just the one variable being set up and allocated (xmlHttp, http_request, etc. In my code, I call it xhr). I needed to address this problem with resource allocation. I recalled this issue of resources from my Operating Systems course and started by creating multiple AJAX request functions that generate their own unique variable (xmlHttp1, xmlHttp2, etc). This still limited me in resources and with complex projects that have multiple requests happening on their own accord, I needed to generate these resources on the fly.

(edit - 02/21/06) I found the problem was in the use of xhr as a global variable. As a global variable, it may be overwritten by subsequent requests. If the xhr is created within the AJAX request function, and return that xhr to the calling function, that variable (and thus, connection) is unique for that calling function. There's no global pool of xhr variables I need to check for availability. Each calling function has their own when they make the call.

So, there it is. Give it a shot and source this to see what's going on.

Multiple AJAX requests at same time
Multiple AJAX requests at random delays (within 3 seconds)
Clear Fields

Progress:

Imported File Contents 1:

Imported File Contents 2:

Imported File Contents 3: