If you are trying to run some dynamically generated JavaScript, you would be slightly better off by using eval
. However, JavaScript is such a dynamic language that you really should not have a need for that.
If the script is static, then Rocket's getScript
-suggestion is the way to go.