开发者

Run a function after another function when ajax loaded

开发者 https://www.devze.com 2023-04-12 11:05 出处:网络
I\'m having a heavy problem that stops me from running jQuery inside of Prototype windows because they are loaded using Ajax.

I'm having a heavy problem that stops me from running jQuery inside of Prototype windows because they are loaded using Ajax.

I think that the solution would be to somehow call the jQuery function immediately after the Prototype UI.Window has fetched the Ajax content, is there any hope for me and my code? :(

This is the Prototype function:

   function openApps() {
      new UI.Window({theme: "ultra_dark",
              width:  1170, 
                   height: 630,
                   superflousEffects: superflousEffects}).center().show().setAjaxContent('template/win_ap开发者_运维问答ps.php', {
        method: "GET", 
        onCreate: function() { 
        this.header.update("Applications");   
          this.setContent('<div class="message">Please wait...</div><div class="spinner"></div>');  
        }
      });  
         }

Now i was thinking about something like:

window.lines = function() {
jQuery(".line").peity("line");
};
jQuery.click(lines);

But i have no idea where is the proper way to place it and if it will work (my bet is that it wouldn't.)

Basically i need jQuery(".line").peity("line"); to run on the Ajax fetched content if someone has some other suggestions - you are welcome.

Thanks.


Not sure if it makes sence, but you can listen on The ajaxStop (Jquery) event; it 's triggered when all Ajax requests are finished


I have no knowledge of Prototype.js but i know how ajax works. So just see if you can use something like a success function of ajax here, so that you can render the data on your DOM first using the response from ajax and then apply jquery on it. You can't apply jquery code on elements that haven't yet been attached to the DOM

0

精彩评论

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

关注公众号