03.04.2023, 08:54
Use this. Since the loading is asynchronous any further code that relies on the remote script must be placed inside the callback function.
Code:
$(function() {
$.getScript('path-to-script.js', function() {
console.log('script loaded');
});
});