Are you returning precisely this : <div id="top">...</div> <div id="middle">...</div> <div id="bottom">...</div>
Or is there a wrapper around these divs like : <html> <body> <div id="top">...</div> <div id="middle">...</div> <div id="bottom">...</div> </body> </html> Because I think I remember jQuery doesn't like to fumble around raw xml without a root element to wrap around it. Michel Belleville 2009/12/9 kingunderscore <brad.kings...@gmail.com> > ok i'm failing, even the piggies aren't helping. > > ok this is the structure of what is coming back from my call. > > <div id="top"> > ........... > </div> > <div id="middle"> > ......... > </div> > <div id="bottom"> > ......... > </div> > > so this is what i am doing... > success: function(htmlReturn){ > mainData = $j('#top', htmlReturn).html(); > topData = $j('#middle', htmlReturn).html(); > leftData = $j('#bottom', htmlReturn).html(); > > $j("#appliedFilters").html(topData); > $j("#notAppliedFilters").html(leftData); > $j("#searchResults").html(mainData); > } > > What am i doing wrong? The selectors i am using to populate the > variables keep returning nothing, i have to have the syntax wrong. > > Any help is appreciated^2 > > On Dec 9, 1:01 pm, Michel Belleville <michel.bellevi...@gmail.com> > wrote: > > Well obvisouly you've got it all now. > > > > Always a pleasure ^^ > > > > Michel Belleville > > > > 2009/12/9 kingunderscore <brad.kings...@gmail.com> > > > > > Hmm ok. > > > > > So i what i am getting from this is that i can refer to elements > > > inside of the response object. > > > > > $('#cold room').html($('house.of_bricks', piggies).html()); > > > > > So in my case if i call my file and build 3 different divs inside of > > > the html output I can then take the innerHTML from each of the > > > response divs and populate the divs that i have on the page. > > > > > I think i got it. I will let you know if it works out. > > > > > thanks a lot for your piggy example :) > > > > > On Dec 9, 12:38 pm, Michel Belleville <michel.bellevi...@gmail.com> > > > wrote: > > > > Well, if you want to load 3 different bits of data to put in 3 > different > > > > places all at once, first you've got to get your server to return the > 3 > > > > little bits of datas in only one query and wrap them in containers so > you > > > > recognize them. So let's assume your unique query returns its results > > > this > > > > way : > > > > > > <houses> > > > > <house id="of straw"> a little piggy </house> > > > > <house id="of_wood"> another little piggy </house> > > > > <house id="of_bricks"> this clever little bastard piggy </house> > > > > </houses> > > > > > > Now let's bring them where they belong. > > > > > > $.ajax({ > > > > url: '/come_to_me_little_piggies.asp', > > > > data: { or_i_will: 'huff', and: 'puff' }, > > > > cache: false, > > > > success: function(piggies) { > > > > // I'm real hungry, so the first one will end up in my stomach > > > > $('#my_stomach').html($('house.of_straw', piggies).html()); > > > > > > // now I'm not so hungry so the second little piggy I'll keep for > > > tomorrow > > > > $('#leftovers').html($('house.of_wood', piggies).html()); > > > > > > // seems like this house of bricks was no match for mr wolf after > all, > > > let's > > > > put little smartass in the cold room > > > > $('#cold room').html($('house.of_bricks', piggies).html()); > > > > > > } > > > > }); > > > > > > But the important thing is if you don't want to do 3 queries, you've > got > > > to > > > > return all data in just one query. > > > > > > Michel Belleville > > > > > > 2009/12/9 kingunderscore <brad.kings...@gmail.com> > > > > > > > First of all i am working in ASP. And i have 3 elements i am > trying > > > > > to populate. I can do that no problem, but my issue is I am > basically > > > > > making the same Ajax request 3 times and there is SQL involved that > i > > > > > would rather only make once. > > > > > > > I have pseudo code below to represent what i am doing. If i could > > > > > just make one call and pull topData, LeftData, and gridData that > would > > > > > cut the processing down significantly. > > > > > > > $j.ajax({ > > > > > url: '/ajaxHandler.asp', > > > > > data: {handleSection:["top"],searchTerm:[''+searchTerm]}, > > > > > cache: false, > > > > > complete: function(){ > > > > > $j.ajax({ > > > > > url: '/ajaxHandler.asp', > > > > > data: > > > > > {handleSection:["left"],searchTerm:[''+searchTerm]}, > > > > > cache: false, > > > > > beforeSend: function(){ > > > > > }, > > > > > complete: function(){ > > > > > }, > > > > > success: function(html){ > > > > > leftData = html; > > > > > > > $j.ajax({ > > > > > url: '/ajaxHandler.asp', > > > > > data: > > > > > {handleSection:["grid"],searchTerm:[''+searchTerm]}, > > > > > cache: false, > > > > > beforeSend: function(){}, > > > > > complete: function(){ > > > > > }, > > > > > success: function(html){ > > > > > gridData = html; > > > > > > > // populate sections > > > > > $j("#top").html(topData); > > > > > $j("#left").html(leftData); > > > > > $j("#grid").html(gridData); > > > > > } > > > > > }); > > > > > } > > > > > }); > > > > > }, > > > > > success: function(html){ > > > > > topData = html; > > > > > } > > > > > }); >