function load(){
//handling Ajax request in case of success, cause once again, load(),
//but for the following pictures
}
...
$each(msg, function(index,value){
var placeholder=$('<span></span>').appendTo('.carousel-inner');
$.ajax(
...
if(i==0){
placeholder.replaceWidth('<div class...
Find more questions by tags jQueryJavaScript