开发者

Re-run jquery script when ajax call is made

I have a jquery float box plugin. The document is loaded and on a buttonpress an ajaxcall triggers box.php which parse the box #floating-box to be floated (the box is then showed on alla pages from now on). The problem is that the script which is within $(document).ready(function(){.. does not find the box (if I refresh it wor开发者_如何学JAVAks so the scipt is OK). I am novice but I guess this could be solved with some kind of livesolution. Can someone guide me in the right direction?

start of jquery script. the script works so the whole script itself is not of interest, rather how to re-run it when box.php have parsed the box #floating-box but still to run it on every document load since the box appears on all pages from now on and needs to float on them too.

var $floatingbox = $('#floating-box');

if($('#floating-container').length > 0){..


    var url = "box.php";
    $("#id_of_button").click(function(){  
        $("#id_of_result").load(url, null, function(){  
                //put script here, it runs when ajax load is complete  
            });  ...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜