DBookatay Posted February 23, 2011 Share Posted February 23, 2011 I have the following script which is attached to a <select> input, that updates a <div> function getBody(yearId,makeId,modelId,trimId) { var strURL="001/AJAX/Add/getBody.php?year="+yearId+"&make="+makeId+"&model="+modelId+"&trim="+trimId; var req = getXMLHTTP(); if (req) {req.onreadystatechange = function() {if (req.readyState == 4) {if (req.status == 200) {document.getElementById('bodyHldr').innerHTML=req.responseText;}}} req.open("GET", strURL, true); req.send(null); } } How do I make it so that when the script gets executed it loads 2 different pages into 2 different divs? "001/AJAX/Add/getBody.php?" loads into "bodyHldr" and "001/AJAX/Add/getEngine.php?" loads into "engineHldr" Link to comment https://forums.phpfreaks.com/topic/228564-how-do-you-change-2-ids-with-one-script/ Share on other sites More sharing options...
sunfighter Posted February 25, 2011 Share Posted February 25, 2011 I'm sure you figured this out by now, but if not try this. What's coming down the pike and into "req.responseText" is a string. Seperate your two pages with a marker (like XXXXX) at the server and cut the req.responseText string into two stringone and stringtwo. Then document.getElementById('bodyHldrONE').innerHTML=stringone; document.getElementById('bodyHldrTWO').innerHTML=string two; Link to comment https://forums.phpfreaks.com/topic/228564-how-do-you-change-2-ids-with-one-script/#findComment-1179372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.