ASP.NET Podcast

ASP.NET Podcast is geared towards the Microsoft .NET Framework and ASP.NET.
The podcast is run by Wally McClure, David Penton, and Paul Glavich.
Welcome to ASP.NET Podcast Sign in | Join | Help
in Search

ASP.NET Podcast

The ASP.NET Podcast features, technical talks, interviews, news, reviews, and Wallyisms. Wallace B. (Wally) McClure, David Penton, and Paul Glavich are your hosts. We talk about ASP.NET, AJAX, Performance, Databases, WCF, Silverlight, Cloud Computing, Windows Azure, and whatever else we decide to talk about.

ASP.NET Podcast Show #128 - AJAX with jQuery

Subscribe to All!

Subscribe to WMV.

Subscribe to M4V (iPod).

Subscribe to MP3.

Download WMV.

Download iPod Video.

Download MP3.

Show Notes:

Source Code:

jQuery Version:

<!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>jQuery Example</title>

</head>

<body>

    <form id="form1" runat="server">

<!--

<script language="javascript" type="text/javascript"

    src="jquery-1.2.6-vsdoc.js"></script>

-->

<script language="javascript" type="text/javascript"

    src="jquery.pack.js"></script>

<div>

<label for="lblOutput">

    Text Out:

</label>

<div id="lblOutput" />

 

<script language="javascript" type="text/javascript">

    $(document).ready(function() {

        $.ajax({

            type: "POST",

            contentType: "application/json; charset=utf-8",

            url: "GetData.asmx/ReturnData",

            data: "{i: 47}",

            dataType: "json",

            success: function(msg) { onSuccess(msg); },

            error: function() {

                alert("An error occurred on the server.");

            }

        });

    });

 

    function onSuccess(msg) {

        var newline = "<br />";

        $('#lblOutput').html("Name: " + msg.d.Name + newline +

                "Notes: " + msg.d.Notes + newline +

                "Passed Value: " + msg.d.PassedValue);

    }

</script>

 

</div>

    </form>

</body>

</html>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

ASP.NET AJAX Version:

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <script type="text/javascript">

   

      function pageLoad() {

          GetData.ReturnData(47, onSuccess);

      }

      function onSuccess(result) {

          var newline = "<br />";

          $get('lblOutput').innerHTML = "Name: " + result.Name +

                newline + "Notes: " + result.Notes + newline +

                "Passed Value: " + result.PassedValue;

 

      }

   

    </script>

</head>

<body>

    <form id="form1" runat="server">

<label for="lblOutput">

    Text Out:

</label>

    <div id="lblOutput" />

 

    <div>

        <asp:ScriptManager

            ID="ScriptManager1" runat="server"

            >

            <Services>

                <asp:ServiceReference

                    Path="~/jQuery/GetData.asmx" />

            </Services>

            </asp:ScriptManager>

    </div>

    </form>

</body>

</html>

Published Wednesday, December 03, 2008 4:00 AM by admin
Anonymous comments are disabled

This Blog

Syndication

Powered by Community Server, by Telligent Systems