Javascript – emulating document.ready() on HTML object

I have a main site A onto which I load content with AJAX from sub-site B. There is a jQuery file that alters elements on the site A (adds events to them, classes, re-renders them if needed etc) that is being launched on document.ready()

Now I need to load content from site B into site A. I do it with a function:

$  .get("/some/url/",{},function(e){
    $  (".some_div").html(e);
});

The problem is if I include jQuery in site B, the following happens: jQuery loads the content, puts it into site A and then triggers all the scripts that were fetched within it. Which causes re-render of the site and whole lot of mess.

What I need to do is to emulate the document.ready() on the HTML object e right after it was pulled out of the site B but before it is appended to the site A (so I will have re-rendered HTML code with all events, classes and listeners ready).

newest questions tagged jquery – Stack Overflow

About Admin