Jquery Code
<script type="text/javascript">
$(document).ready(function()
{
$.getJSON("http://localhost/index.php/upload/history",function(data)
{
$.each(data.images, function(i,data)
{
$('#recent').html( '<img src="/t/' +data.imagename + '">' );
});
}
);
return false;
});
</script>
sample json data
{
"images": [
{
"imagename": "p5Tsa.jpg"
},
{
"imagename": "Z8hjA.jpg"
},
{
"imagename": "0Fnm0.jpg"
},
{
"imagename": "D5Tfa.jpg"
},
{
"imagename": "VDnvu.jpg"
},
{
"imagename": "9spgp.jpg"
},
{
"imagename": "Hg7va.jpg"
}
]
}
This shows only the first image .. but when I use append() , then it shows all the images thats in the json response.. the reason I want to avoid append is that I want to refresh the div usng setInterval().
How to show all the images that I get in the json response using .html() ?
thanks :)