Looping div from parent div using JQuery
guys..
I just wanna loop my div from return json result....as you can see here's the desire result I'm after
<div id="doaimgbox"><!-- parent div -->
<!-- start looping portion -->
<!-- I wanna loop this div based on length json return result let's say 3 --&g开发者_开发知识库t;
<div class="imgdiv">
<img src="imagedoa/d0.jpg" width="400" height="150" />
<div id="rbox">
Was sent <span class="counter"></span> times.
<br/>
<br/>
<br/>
<span class="buttonshare"><a href="">Click to select</a></span>
</div>
</div>
<!-- looping portion -->
as you can see below here are my attempt but no to avail..
$.ajax({type :'GET',
url : 'getallimg.php',
dataType : 'json',
success : function(data){
$.each(data, function(i,item){
$("#loader").hide(500);
$("<div class='imgdiv'><img src='imagedoa/"+item.imgname+".jpg' width='450' height='150' /></div></br>")
.appendTo("#doaimgbox");
});
Really need help ..suggest me the best solution or suggestion..tq
精彩评论