ASP.NET Podcast Show #128 - AJAX with jQuery - More Wally - Wallace B. McClure
in

MoreWally.com

Giving people what they want, More Wally. This is the technical and personal blog site of
Wallace B. (Wally) McClure.

This Blog

Syndication

Technical Sites

Archives

More Wally - Wallace B. McClure

This blog will have all kinds of posts about Wally McClure. In it, there will be tons of .NET and computer programming posts as well as Wally's views on life in general. As you might guess, this site and blog help you get More Wally in your life. What more could anyone want? iPhone, Android, Xamarin.iOS, Xamarin.Android, Mobile, HTML5, .NET, ADO.NET, ASP.NET, AJAX, jQuery, jQuery Mobile, ASP.NET AJAX, and Windows Azure............follow me on twitter at Wally

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.

Original Url: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2008/12/03/asp-net-podcast-show-128-ajax-with-jquery.aspx

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>

Comments

 

Dew Drop - December 3, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - December 3, 2008 | Alvin Ashcraft's Morning Dew

December 3, 2008 9:36 AM
2006 - Wallace B. McClure
Powered by Community Server (Non-Commercial Edition), by Telligent Systems