Q:

jquery ajax and html

Does anybody know how to execute javascript functions in an html that is loaded via ajax?  I mean the html contains both plain text and javascript.  In my case it seems that only the in-line javascript (eg.  onclick="dosomething();return false") gets executed.  The pre-defined functions which are wrapped by < script   language     = "javascript     >are unfortunately ignored..
i have search couple articles through the site but the results are either use getScript to load a pure js or use eval.  please help me out of this!  Thank you very much! 

A:

File 1:
<script type="text/javascript">
function test() {
  alert('i got loaded dynamically!'); 
}
</script>

File 2:
$.get('file1.html', function(html) {
  $(document).append(html);
  test(); // alerts "i got loaded dynamically!" 
});

See it in action.