不确定这是否可行或如何进行.我在$.ajax响应中使用以下内容完全正常,但是,我需要调用函数loadSlider();循环完成迭代后.
if (response.success) { $.each( response.screenshots,function( index,value ) { //add the slide $( '#slider1' ).prepend( '<li data-id="'+value.screenshot_id+'"><img src="/showimage.PHP?show='+value.image_filename+'" alt=""></li>' ); //add the pager $( '#rslides-pager' ).prepend( '<li><a href="javascript:;"># here</a></li>' ); }); //want to call loadSlider(); AFTER everything above is completed }