On my site I have a jquery function which retrieves data from another (secured) server as soon as the page is loaded. Using a jsonp call I currently load this data after doc
As long as you place the script tag that includes jQuery above your script tag that runs your function then it should work fine.
Wrapping your script in this instead of the ready function may help:
(function() { // Your code here })();