I'm working on a simple JavaScript web app with a file structure of:
index.html
scripts/
| main.js
styles/
| main.css
templates/
| options.mst
| progress.mst
The JavaScript and CSS files are loading fine, and then I grab the templates with an AJAX call:
_.each(['options', 'progress'], function (templateName) {
$.ajax({
url: '../templates/' + templateName + '.mst',
success: function (data) { templates[templateName] = data },
error: function () { console.log('Could not load template: ' + templateName); },
});
This works fine when I serve the site from Python's SimpleHTTPServer
, but now that I'm trying to move it to a local IIS 7.5 server it's forming the template URL as though the JavaScript were executing from the root /
folder, not /scripts
. In other words I'm getting a 404 when it looks for http://localhost/templates/options.mst
instead of http://localhost/my-app/templates/options.mst
. Does anyone know why this is happening? I've looked at some related posts like this one, but I'd rather not use anything IIS-specific in my code like the ~
operator.
UPDATE: I followed the instructions on this page to enable "parent paths", but I'm still having the same results.