Home / AJAX

Page History: Microsoft Ajax Content Delivery Network

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: 2010/11/16 09:17



The Microsoft Ajax Content Delivery Network (CDN) enables you to easily add popular JavaScript libraries such as jQuery to your Web applications. For example, you can start using jQuery simply by adding a


The CDN also includes the minified version of the jQuery script, which you can get using the following element:



    

The following sample page uses the CDN version of the jQuery library to display the contents of a div element when a button is clicked.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>jQuery from Microsoft AJAX CDN</title>
        <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js" type="text/javascript"></script>
 
        <script type="text/javascript">
        
        $( domReady );
        
        function domReady() {
            $('#btn').click( showMessage );
        }
        
        function showMessage() {
            $('#message').fadeIn('slow');
        }
        
        </script>
    </head>
    <body>
 
    <button id="btn">Show Message</button>
 
    <div id="message" style="display:none">
 
        <h1>Hello from jQuery!</h1>
 
    </div>
 
    </body>
    </html>
 
You can learn more about jQuery and download a local copy of jQuery by visiting the jQuery Web site.

Using jQuery UI from the CDN

The Microsoft Ajax CDN also includes the jQuery UI library. The jQuery UI library includes a rich set of widgets and effects that you can use in your ASP.NET applications. For example, the following page illustrates how you can use the jQuery UI Datepicker in the context of an ASP.NET Web Forms application to display a pop-up calendar:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestjQueryUICDN.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Using jQuery UI from the CDN</title>
    <link type="text/css" rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.5/themes/redmond/jquery-ui.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ID="txtStartDate" ClientIDMode="Static" runat="server" />

</div> </form>

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.5/jquery-ui.js"></script>

<script type="text/javascript">

$("#txtStartDate").datepicker();

</script> </body> </html>

When you move focus to the TextBox using your keyboard, a calendar is displayed:

Popup calendar created with Datepicker

Notice that you must include three files from the CDN in the code above:

  • The jQuery library — The jQuery UI library depends on the jQuery library. You must add the jQuery library to your page before you add the jQuery UI library.

  • The jQuery UI library — The jQuery UI library contains all of the jQuery UI effects and widgets such as the Datepicker widget used in the page above.

  • A jQuery UI theme — The jQuery UI supports different themes. The page above includes a link to a CSS file to import the Redmond theme.

All of the standard jQuery UI themes are included on the Microsoft CDN. Visit this page to view thumbnails for each theme.

To learn more about the jQuery UI library, visit the official jQuery UI website.



Third-Party Files on the CDN

These libraries are provided by the respective vendors and not Microsoft.

jQuery Releases on the CDN

The following releases of jQuery are hosted on the CDN:

jQuery version 1.4.4

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4-vsdoc.js

jQuery version 1.4.3

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.3.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.3.min.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.3-vsdoc.js

jQuery version 1.4.2

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2-vsdoc.js

jQuery version 1.4.1

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1-vsdoc.js

jQuery version 1.4

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.min.js

jQuery version 1.3.2

  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.3.2.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.3.2.min.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.3.2-vsdoc.js
  • http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.3.2.min-vsdoc.js

jQuery UI Releases on the CDN

The following releases of the jQuery UI library are hosted on this CDN. Click each link to see the actual list of files.


jQuery Validation Releases on the CDN

The following releases of the jQuery Validation library are hosted on this CDN. Click each link to see the actual list of files.


jQuery Templates Releases on the CDN

The following releases of the jQuery Templates plugin are hosted on this CDN. Click each link to see the actual list of files.


jQuery Cycle Releases on the CDN

The following releases of the jQuery Cycle plugin are hosted on this CDN. Click each link to see the actual list of files.


Ajax Control Toolkit Releases on the CDN

The following releases of the client portion of the Ajax Control Toolkit are hosted on this CDN. Click the link to see the actual list of files.


Microsoft Files on the CDN

These libraries were uploaded by Microsoft.

ASP.NET Ajax Releases on the CDN

The following releases of the ASP.NET Ajax Library are hosted on the CDN. Click each link to see the actual list of files.

ASP.NET MVC Releases on the CDN

The following ASP.NET MVC JavaScript files are hosted on this CDN:

ASP.NET MVC 1.0

  • http://ajax.aspnetcdn.com/ajax/mvc/1.0/MicrosoftMvcAjax.js
  • http://ajax.aspnetcdn.com/ajax/mvc/1.0/MicrosoftMvcAjax.debug.js

For information about the terms of use for the CDN, see Microsoft Ajax CDN Terms of Use.