Monday, January 26, 2009

JQuery - Microsoft Ajax - JSON

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
<!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">
    <script src="MicrosoftAjax.js" type="text/javascript"></script>
    <script src="jquery-1.2.6.pack.js" type="text/javascript"></script>
    <script type="text/javascript">
        function serializeJSON(data) {
            return Sys.Serialization.JavaScriptSerializer.serialize(data);
        }

        $(document).ready(function() {
            var value = "Paul";
            alert(serializeJSON({ nom: value }));
        });
    </script>
</head>
<body>
</body>
</html>

No comments:

Post a Comment