How to add additional JavaScript code [duplicate]

Technically yes, you can add those lines to your header.php file just after the wp_head() function and it’ll load the jQuery from a remote source, just like it was on your local machine.

If you want to do it properly, take a look at http://codex.wordpress.org/Function_Reference/wp_enqueue_script which will allow you to add it through the wp_head() hook, which will check to make sure the script hasn’t already been loaded.