I have a INDEX.html and some <DIV>'s that are populated with external HTML-files using jQuery LOAD()
Some of the external HTML's also contains Javascripts.
Seperately these external HTML's all perform well, when displayed in the DIV the script won't run.

There should be a solution to this but I cannot find it.....

This is the loading-function

>  <script type="text/javascript" > 
> $(document).ready(function() {
> $('a.linkje').click(function() {
>   var url = $(this).attr('href');
>   $('#master').load(url);
>   return false;
>   });
> });
> </script>

-----------------------------------------------------------------------------
Some tips on HOW TO will be highly appreciated!

Member Avatar for stbuchok

If you read the documentation for the load method, there is the ability to provide a callback function that can be called.

Have your javascript in an external file and then when you load the html page using jquery.load, call the javascript in the external file.

mypage
    reference to externalpage.js
    reference to mypage.js

externalpage


externalpage.js


    function externalPage_complete(response, status, xhr){
            //code goes here
        }



mypage.js


    $('div').load(url, {}, externalPage_complete);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.