Load javascript file on the fly

I needed to load a javascript file on the fly with jquery so this is the solution I came up with:

$.getScript("js/test.js", function() {
    callback_function();
})


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.136.97.64
To prevent spam please submit by clicking the kitten: