I can't guess when and from where in your document you load your JS files.
Nor can I guess what you mean by a "variable is dependent upon an external resource", nor what you mean by "loading" the form.
Do you load the form using Ajax? Or is the form just part of your page? Do you populate values in the form with Ajax? Or with some javascript code?
Too many things to guess at.
The best way to get help here is to prepare a demo, either on your site, or using jsfiddle.
----
If you load your JS synchronously in <head>, and put your code in $(document).ready() then your code will not run until the page content is fully loaded.