I have a script, TemplateLoader.js
which loads 2 Mustache templates, and renders them on the page (or at least that's the goal).
My directory structure:
COMP266
Unit 4
scripts
mustache.min.js
TemplateLoader.js
PageUsingTemplateLoader.html
Inside of TemplateLoader
(the object), I have the following chunk to load Mustache, and render the templates:
$.getScript("./scripts/mustache.min.js", function() {
$('head').html( Mustache.render(headTemplate, data) );
$('body').html( Mustache.render(bodyTemplate, data, uniqueBodyTemplate) );
});
This however, yields the following error in the developer console:
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): GET - http://localhost:63342/COMP266/Unit%204/mustache.min.js?_=1450903391318
Oddly, it seems to have dropped the script
folder completely from the path.
I decided to play around, so I changed the fetch path to (duplicating the script folder):
./scripts/scripts/mustache.min.js
But this yields:
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): GET - http://localhost:63342/COMP266/Unit%204/scripts/scripts/mustache.min.js?_=1450903743022
Now it's listening! Unfortunately, this is obviously the wrong path.
I have no idea how to go about debugging this. It seems like jQuery is selectively dropping the scripts
folder. That seems ridiculous, but just to make sure, I searched through the jQuery source, and couldn't find anything that would be doing the observed filtering of the path.
It's currently local, not hosted.
Can anyone give me a hint about what's going on here?