electricshoe Posted February 13, 2008 Share Posted February 13, 2008 So I use a function to create multiple requests in an array so I can use multiple ajax requests at the same time. This works great until it comes time to get the response text request_array[i].onreadystatechange = function() { update_target(i,target) } function update_target(request_array_key,target_to_update) { if (request_array[request_array_key].readyState == 4) { if (request_array[request_array_key].status == 200) { document.getElementById(target_to_update).className = ''; document.getElementById(target_to_update).innerHTML = request_array[request_array_key].responseText; } } } If I create 3 requests it will run all 3 successfully, and I get all 3 returns in firebug, but it only updates the innerHTML on the last one. Why is this? It's got to be some kind of order of operations thing. Link to comment https://forums.phpfreaks.com/topic/90839-multiple-ajax-requests-problem-with-responsetext/ Share on other sites More sharing options...
phpQuestioner Posted February 13, 2008 Share Posted February 13, 2008 This thread really belongs in the AJAX Forum; which can be found here: http://www.phpfreaks.com/forums/index.php/board,51.0.html Link to comment https://forums.phpfreaks.com/topic/90839-multiple-ajax-requests-problem-with-responsetext/#findComment-465629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.