0x800a1391 - JavaScript Runtime Error: 'jQuery' Is Undefined
I have a ASP .Net MVC4 Web application. In it I have my usual html for the _Layout.cshtml, which in turn loads the default Home/Index. All works fine. In my index I am also loading
Solution 1:
Try setting the src for jQuery to be absolute from the site root:
<script src="/assets/plugins/jquery-1.8.3.min.js" type="text/javascript"></script>
Note the /
before assets
- when your src path does not start with a /
the browser will try and load the asset relative to the current path, so in your example when you add the trailing slash to Home
it will try to load jQuery from Home/assets/plugins/...
Solution 2:
For me, the MVC bundlers were causing problems (in my case the ui bundler)
Here is the order which worked for me.
<script src="/Scripts/modernizr-2.5.3.js"></script>
<script src="/Scripts/jquery-1.7.1.js"></script>
<script src="/bundles/jquery-ui"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
Solution 3:
You need to add the jquery-x.xx.x.js first before the validate.js like this
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
Post a Comment for "0x800a1391 - JavaScript Runtime Error: 'jQuery' Is Undefined"