It seems that the problem is that the jQuery library does not load when you are working on localhost , or the AJAX request is not working for the same reason. This is due to the protection built into the browser to prevent cross-site scripting .
See this βextra noteβ from the documentation for load :
Due to browser security restrictions, most Ajax requests are subject to the same origin policy; The request cannot successfully retrieve data from another domain, subdomain, or protocol.
If you use any AJAX, you will have to run it on a local web server. In this case, you should simply run this page from your local web server, and not from the file system. Then you will not need workarounds.
If you are running Windows, you can use UniServer .
If you are not going to use any AJAX (not using load ), you can write your code so that it returns to the local version of jQuery if the remote version did not load.
Here is an example of how captured from this page :
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script>!window.jQuery && document.write('<script src="/Scripts/lib/jquery/jquery-1.4.4.min.js"></script>'))</script> <script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> <script>!window.jQuery.validator && document.write('<script src="/Scripts/lib/jquery/jquery.validate.min.js"></script>')</script> <script src="//ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"></script> <script>!window.jQuery.validator.unobtrusive && document.write('<script src="/Scripts/lib/jquery/jquery.validate.unobtrusive.min.js"></script>')</script>
source share