<ul>
<li id="1"></li>
<li id="2"></li>
<li id="3"></li>
</ul>

$(function() {
        $('li').each(function() {
                var $id = $(this).attr('id');
                $.post('getImg.php', {id: $id}, function($data) {
                        // How to do it?
                });
        });
});

I want to let each li use ajax load their own image and put into
thierself, the result shold like below, but if I user $.post, I don't
know how to put it to the right li.
<ul>
<li id="1"><img src="1.jpg"></li>
<li id="2"><img src="2.jpg"></li>
<li id="3"><img src="3.jpg"></li>
</ul>

Reply via email to