Dynamically loading external HTML in a div using Java Script
        Posted  
        
            by user354051
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user354051
        
        
        
        Published on 2010-05-31T14:12:30Z
        Indexed on 
            2010/05/31
            14:43 UTC
        
        
        Read the original article
        Hit count: 280
        
jQuery
I have prepared some demo examples for the topic. There is page name "changelog.html" here:
http://pantheon-studios.in/test/jquery/changelog.html
This is working fine if loaded directly.
I am trying to load this page dynamically into:
http://pantheon-studios.in/test/jquery/index.html
Here changelog.html doesn't behaving as expected.
I think the init script on changelog.html is not getting executed or something else is happening when loading it dynamically.
Like wise I do have couple of other pages using various jQuery and other java scripts plugins. Some of those needs initialization like animatedcollapse.js in the above example, and couple of them doesn't need initialization, you can directly call the script and go.
I also gave a try using:
jQuery.getScript("anim.js")
after dynamically loading "changelog.html" but doesn't work.
The "anim.js" contains
animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets,hide=1');
animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,hide=1');
animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1');
animatedcollapse.init();
I would really appreciate is some one point me out the right direction. I am completely new to web programming so please have some patience with me.
Thanks
© Stack Overflow or respective owner