I currently have a requirejs module that lives on a remote server such as the below that defines some backbone views, models
define(['...'], function() {
......
return {
model : suggestion_model,
view : suggestion_view
};
});
that is being dynamically loaded in another file as such
let script = $("<script>").attr({
src: "http://localhost:9000/assets/javascripts/autocomplete/autocomplete-model-view.js",
});
console.log(script);
$("head:first").append(script);
I see that the file is loaded, when I go to my tag but I can't access the module to be used in any of the code.
How could I go about actually accessing these defined requirejs module in some other files?