Jquery async setup
I have a php scr开发者_运维技巧ipt which when fired, collects some data on different sites using an AJAX call in jquery, and displays the results in a Div.
I also have a lightbox plugin which needs to be reinitialised after the result of the ajax call has loaded. To enable this, I've turned async off ($.ajaxSetup({async:false});) so it doesnt load before the results div has finished loading.
This works fine, except for in Chrome (and I would assume IE) where the 'loading' image is not displayed when this setting is in use.
Is there a smart way around this?
you can still do it asynchronously, just do your initialisation inside the success callback function:
$.ajax({
url:'',
data:'',
success:function(response){
// init your lightbox here
}
});
精彩评论