On 26 jan, 16:28, Nathan Klatt <n8kl...@gmail.com> wrote: > On Tue, Jan 26, 2010 at 9:27 AM, Nathan Klatt <n8kl...@gmail.com> wrote: > > newDiv = createElement("div"); > > newDiv.load("http://mydomain.dev/search/view/Id/" + $(this).attr("id") > > + ".html"); > > newDiv.insertAfter(".address"); > > Whoops, be sure to turn newDiv into a jQuery object after creating it.
that is nog wokring for me. the ajax respons contains already the div. second problem i made my own accordeon so there are more .address classes on the page. so as soon as i click on a h5 heading it will toggle the next div an it has to make an ajax call and insert the conent in the right div. SCRIPT: jQuery(document).ready(function() { $('.accordion .head').click(function() { $(this).next().insertAfter('.address').load('http://yii.dev/ search/view/IdDaytrip/' + $(this).attr('id') + '.html'); $(this).next().toggle('slow'); return false; }).next().hide(); }); PAGE: <h5 class="head" id="dt_7788">Joepie</h5> <div style="display: none;"> <fieldset class="address"> <ol> <li>Meerweg 4</li> <li>1921BR Akersloot</li> <li>0251-317509</li> </ol> </fieldset> <span>Tags: straatgolf</span> </div> <h5 class="head" id="dt_758">Joe</h5> <div style="display: none;"> <fieldset class="address"> <ol> <li>Meeeg 4</li> <li>1921BR Fsloot</li> <li>0654-3132409</li> </ol> </fieldset> <span>Tags: golf</span> </div>