I work on asp.net mvc5 project.
I have this code:
//Load Bootstrap JS
var plugin_path = 'assets/plugins/'
loadScript(plugin_path + 'bootstrap/js/bootstrap.min.js', function() {
Init(false);
});
And this:
var _arr = {};
function loadScript(scriptName, callback) {
if (!_arr[scriptName]) {
_arr[scriptName] = true;
var body = document.getElementsByTagName('body')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = scriptName;
script.onload = callback;
body.appendChild(script);
} else if (callback) {
callback();
}
};
when my application starts on landings page evrything works perfect.
When I move to another page, on this row:
body.appendChild(script);
I get this error:
http://localhost:111/Home/assets/plugins/bootstrap/js/bootstrap.min.js
Application try to search this file:
bootstrap.min.js
on this path:
http://localhost:111/Home/assets/plugins/bootstrap/js/
While on landing page this file bootstrap.min.js has been searched in this path:
http://localhost:111/assets/plugins/bootstrap/js/bootstrap.min.js
and evrythng works fine.
So I gess the problem with searched path.
Any idea why searched path is changed when I move to another page?