I've a for-loop and it won't pass it's i variable or any kind of a variable into Jquery function coded to run with every loop.
for (var i = 0; i < result.length; i++) {
$('#frame-' + i + '').fadeOut(function () {
ALERT(i);
document.getElementById('frame-' + i + '').getElementsByTagName('img')[0].src = 'img/' + result.cat[i].id + '.png';
});
$('#frame-' + i + '').fadeIn();
}
I found that I can use .on or .bind functions but I've no idea how it should be done with fadeOut().
fadeOut.on() won't work.
Any suggestions to get this working?
frame-'+i+''withframe-'+iiis out of scope in the callback.alert()is not the same asALERT().