How do I handle concurrent AJAX requests?

With JavaScript you can have more than one AJAX request processing at a single time. In order to insure the proper post processing of code it is recommended that you use JavaScript Closures. The example below shows an XMLHttpRequest object abstracted by a JavaScript object called AJAXInteraction.

As arguments you pass in the URL to call and the function to call when the processing is done. Function AJAXInteraction(url, callback) { var req = init(); req. Onreadystatechange = processRequest; function init() { if (window.

XMLHttpRequest) { return new XMLHttpRequest(); } else if (window. ActiveXObject) { return new ActiveXObject("Microsoft. XMLHTTP"); } } function processRequest () { if (req.

ReadyState == 4) { if (req. Status == 200) { if (callback) callback(req. ResponseXML); } } } this.

DoGet = function() { req. Open("GET", url, true); req. Send(null); } this.

DoPost = function(body) { req. Open("POST", url, true); req. SetRequestHeader("Content-Type", " application/x-www-form-urlencoded"); req.

... more.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions