I have a html page (index.html) which calls the ajax page(aj.php). The Ajax Page will return some number of <li>
's, like
<li>Blue Flower</li>
<li>White Assassin</li>
I already have some list items in the <ul>
of the html page(index.html). When i try to append the result of the ajax page ie, <li>
's, it is appending at the last.
I want the <li>
's which returned from ajax page should be at first. How to achieve this. Please help. Any help will be appreciated
如果你想首先拥有这些物品,它的前置 ,不附加:-)
Are you looking for the .prependTo()
function of jQuery? Docs are here .
So it'd be something like:
var returnedLIs = fromPHP;
$(returnedLIs).prependTo($('your ul'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.