Reputation: 16224
I thought it is good practice to put the loading of scripts at the bottom of the page. Hence, I have the scripts (jquery01.5.1.min.js) located at the bottom of the layout file.
However, the moment I started using Ajax, eg in a WebGrid, it inserted a:
<script type="text/javascript">if (typeof(jQuery)=='undefined') alert("A jQuery script reference is required in order to enable Ajax support in the \"WebGrid\" helper.");</script>
somwhere at the <TABLE> tag. This spoils the show.
Is there any way to overcome this and still have the scripts loaded at the end of the page?
Thanks.
Upvotes: 1
Views: 374
Reputation: 41236
You can always add a quick header file to take the jQuery
variable and make sure it is initialized. jQuery should be able to go back through then and load itself after that code is hit. AKA
<script type="text/javascript" language="javascript">
var jQuery = {};
</script>
Upvotes: 3