views:

39

answers:

2

I'm using jquery.load() to dynamically load sections of a page. But I'd like the included sections to be able to execute script. A simple

<script>
    alert("hello");
</script>

doesn't run when I AJAX it in. Is there another way to dynamically load content such that the scripts will run, or a way to manually run scripts in the included content?

FWIW I'm using Jquery 1.4.2.

+1  A: 

Try changing the script in the loaded page to:

<script>
    $(function(){
        alert("hello");
    });
</script>

This should make it run when it's loaded.

Rocket
Unfortunately this isn't working for me. Nor is $(document).ready(function(){...});
Leopd
Sorry, it was worth a shot.
Rocket