javascripthead.jsresource-loading

Using Head.js from an external JS file to load resources


I have an HTML file which includes a JS file in the head tag..

<script type='text/javascript' src='lib/head.core.min.js'></script>
<script type='text/javascript' src='custom/my.js'></script>

In the my.js file I try to load another JS file to use in my.js:

head.load("custom/foo.js");

But anytime I try to execute a function from foo.js I get the following error:

Error after calling a function from *foo.js*

Am I doing something in an incorrect way?


Solution

  • You need to include head.load.min.js, not head.core.min.js to use the head.load function.