[jQuery] Execute script loaded into div from ajax

[jQuery] Execute script loaded into div from ajax


Hello everyone,
I'm trying to do something that's probably trivial, but I can't get it
to work :p
My main page has a div where content gets loaded via ajax:
$('#main').load('page.html');
The file page.html has some html and javascript code, the problem is
getting the javascript from page.html executed. I tried using a
callback like this (found here on this list):
        $('#main').load('page.html',
                {},
                function() {
                    $("#main script").each(function(ind,obj){eval($(obj).text());});
                });
but no success so far.
Can anyone point me in the right direction?