function checkallfolder(){
var thumbnailbox = $('#thumbnailbox');
var foldertype = ["img1", "img2", "img3", "img4", "img5", "img6", "img7"];
for (var c = 0; c < foldertype.length; c++ ){
var folder = 'Img/dfolder/'+foldertype[c];
$.ajax({
type : "POST",
url: "data.php",
contentType:"application/x-www-form-urlencoded",
dataType: "json",
data: "folder="+folder,
success: function(d) {
var temp = '';
thumbnailbox.html('');
for (var obj in d){
if (d.hasOwnProperty(obj) && d[obj].hasOwnProperty('src') && d[obj].src !== ''){
var objname = d[obj].name;
temp += "<div><img name="+d[obj].name+" class='icon' src="+d[obj].src+"></div>";
console.log(d[obj].src);
}
}
thumbnailbox.html(temp);
}
});
}
}
my intention is to use ajax check all folder inside image , so i loop it with "for" and i checked the con log it do load 7 times and all object are calling out but then i try to output them as "img" with "src". i only get the last img , only folder7/img7 had be show up. what is wrong with my code? all the "src" had been call out , it should be having all image. can anyone help me take a look ?