A lower average JS / JQ person is here.
I am trying to avoid the callback addon using JS fetch. It is billed as an “AJAX replacement” and seems pretty powerful. I see how you can create HTML and JSON objects with it ... but is it possible to run another JS script from the one you are in? Perhaps ES6 has another new feature:
$.getScript( 'xxx.js' );
i.e.
$.ajax({ url : 'xxx.js', dataType : "script", });
...
later, an answer to Joseph the Dreamer:
Tried this:
const createdScript = $(document.createElement('script')).attr('src', 'generic.js');
fetch( createdScript )...
... he did not run the script "generic.js". Did you mean something else?
source
share