Home / AJAX

HOW TO Load jQuery

Modified on 2009/12/04 17:25 by Stephen Walther Categorized as Uncategorized
The ASP.NET Ajax Library provides full support for jQuery and jQuery Validate out-of-the-box and even allows different Microsoft Ajax components to be treated like jQuery extensions. The Script Loader can be used to load a jQuery script by using Sys.require and providing the Sys.scripts.jQuery value. This is made possible by Start.js which registers different jQuery and jQuery Validate scripts:
loader.defineScripts(null, [
 { name: "jQuery",
   releaseUrl: ajaxPath + "jquery/jquery-1.3.2.min.js",
   debugUrl: ajaxPath + "jquery/jquery-1.3.2.js",
   isLoaded: !!window.jQuery
 { name: "jQueryValidate",
   releaseUrl: ajaxPath + "jquery.validate/1.5.5/jquery.validate.min.js",
   debugUrl: ajaxPath + "jquery.validate/1.5.5/jquery.validate.js",
   dependencies: ["jQuery"],
   isLoaded: !!(window.jQuery && jQuery.fn.validate)
To load jQuery the following code can be used:
<script type="text/javascript">
Sys.require([Sys.scripts.jQuery],function () {
    //Use jQuery functionality

This code calls Sys.require and passes the Sys.scripts.jQuery value into it along with a callback function to invoke once the jQuery script has loaded.