Weird problem with loading/rendering DOM
Hello,
i already spent more than 48 hours for this problem, and still no idea to solve it..
here's my scenario:
i have a function (i.e: getPreview() ) that load a preview of an image , the load are done with ajax. now getPreview() is triggered from a button (i.e: .renderbtn)
There's no problem with the above scenario, the problem arise when i want to build a button to show all preview.
Here's my function code:
function showall(){
$j.each($j('.renderbtn'), function(index) {
getPreview($j(this).attr('id'),'pin_tools','render');
});
}
with the above, only the last item is rendered. BUT if i add alert():
function showall(){
$j.each($j('.renderbtn'), function(index) {
getPreview($j(this).attr('id'),'pin_tools','render');
alert('Display item :'+(index+1));
});
}
eventthough there are alert, all display correctly...
Now, i'm thinking to pause the proses with this code:
function pausecomp(ms) {
ms += new Date().getTime();
while (new Date() < ms){}
}
function showall(){
$j.each($j('.renderbtn'), function(index) {
getPreview($j(this).attr('id'),'pin_tools','render');
pausecomp(1500)l
});
}
But the problem still arise, any idea what i should do ?
Thanks