That's right decepti0n, it may not be worth making multiple requests at a time. Also, you window is the only listener, so you would like to avoid bottle neck.
I have 2 different div's that returns a responseText. I tried calling the requests one after another buy somehow only the 2nd div is updated. The first one is inact. I'm not sure why this is happening. I have it set up like this. [ link ] A user clicks the link and it calls an ajax request to update <div id="test1">. The same function called by clicking the link will call another ajax request after the first request to update <div id="test2">. Anybody can help me solve this?
could you do it in a single ajax request and just return 2 different sections of xml...then parse the xml for div1 into div1 and the xml for div2 into div2..or you could use JSON. if you're not interested in that you could always have something like the following 1. user clicks the link 2. javascript kicks off ajax call 1 3. browser gets reply from server 4. javascript updates div1 5. javascript kicks off ajax call 2 6. browser gets reply from server 7. javascript updates div2 and please tell me that you're using prototype.js! Happy coding!
I know this topic is old, but if anyone still interests in Multiple Ajax Request and using PHP, please try KoolAjax control Here is example of multiple requests: http://www.koolphp.net/support/demos/#koolajax.example_simultaneous_requests Or you may see this examples, 9 multiple requests at same time: http://www.koolphp.net/support/demos/#koolajax.example_loading_panel (Try to click other boxes when some boxes are loading) In the second example, you may find out that there is absolutely no javascript involved.
Or you can simply use my AJAX requests class It has a very simple functionality, yet you can do a lot of stuff with one-line requests. Create as many requests as you like, each requires just a single line of code