I’m working on a search for amd I have the following line of code:
$('#searchResults').add($('li:last').load(url + '&' + urlExtra));
This adds 10 li tags with content but rather than it adding to the ul it’s nesting the last li with the loaded in list. To try and clarify i would like this outcome:
<ul>
<li>already in list</li>
<li>already in list</li>
<li>already in list</li>
<li>already in list</li>
<li>new li from load</li>
<li>new li from load</li>
</ul>
But i’m getting this:
<ul>
<li>already in list</li>
<li>already in list</li>
<li>already in list</li>
<li>already in list
<li>new li from load</li>
<li>new li from load</li>
</li>
</ul>
Any pointers in the right direction would be greatly appreciated.
Kind regards
Rachel
Use
jQuery.get()instead :#searchResultsin my case is theul. This uses.append()to add the newlito the end of theul