开发者

Jquery async setup

开发者 https://www.devze.com 2023-04-10 05:06 出处:网络
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 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
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号