Executing multiple XMLHTTPRequests – successfully.

So I’m hacking together a simple client-side AJAX – based on AHAH - and all of the example scripts only work with a single request.  Attempting to use the same script twice meant that the results would overwrite each other.  Ughh.

The problem it turned out, was as a simple as the latter requests replacing the newer request, because their references were being overwritten.  So instead of using a single variable, I figured “why not pass the references around in the functions”.  Here it is then, an AHAH-based set of AJAX functions, that works for multiple simultaneous function calls.

Source code doesn’t really work very well in my blog template, so I’ve put the functions in an external javascript file…

Click here to download the javascript file.

, ,

About James

James is a Senior New Media Developer at MMT Digital, and has BA(Hons) in Design for Interactive Media from the University of Gloucestershire. He loves designing and producing all sorts of website and Flash-related things, as well as prattling on about technologies.Day-to-day he works with Flash, Dreamweaver, Director, Microsoft Office Sharepoint Server 2007 (MOSS) and in his spare time he mucks about in Flex and Wordpress.Follow James on Twitter.

Connections and Related Posts

You can connect with Psyked.co.uk through other media using these links:

4 Responses to “Executing multiple XMLHTTPRequests – successfully.”

  1. PeteCook 7th July, 2010 at 10:36 pm # Reply

    This is ace :)

  2. Mikael 1st March, 2011 at 3:38 pm # Reply

    If the laws of nature allowed it, I’d bear your children. Thanks :-)

  3. Ercan MUTLU 25th October, 2011 at 4:13 pm # Reply

    Hey MAN you THINK VERY GENIUSLY,AND ITS WORK PERFECT.

    I use your opinıon on my project AND works perfect..

    THANK !….

    There is solution STORRING HXL OBJ.TO ARRAY BUT IT LAKS MEMORY…. This solution avere seen is the BEST SOLUTION.

    HELLO FROM LOVELY COUNTRY TURKEY.

  4. Omokoii 17th January, 2012 at 4:36 pm # Reply

    Sweet bananas, this is what I was looking for ^^

Leave a Reply

Note: This post is over 3 years old. You may want to check later in this blog to see if there is new information relevant to your comment.