The onload event on script tags may or may not work depending on browsers.
If you are using jQuery than you can use $.getScript() function to load a javascript file and assign a callback function to it. The callback is fired when javascript code has been loaded.
If you are not using a JavaScript framework then you can still use the above mentioned code to inject the script tag inside DOM. This should work in all browsers but there is no bullet proof way to determine when the script actually loads. onload may or may not work.
From this point you can try "polling" for a symbol every few seconds. This means you use window.setInterval() function to execute a polling function every few seconds after injecting the script tag. Inside the polling function you can use the JavaScript typeof operator to see if a particular variable is undefined or not (for the above example you would check whether typeof jQuery.fn.hint is undefined or not). Once it is defined, cancel the polling function and execute that some operation.