Ajax的用法之JQuery

示例:

<!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-Ajax</title>

    <script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        $(function() {
            $("#button1").click(function() {
                $.ajax({
                    type: "GET",
                    url: "check.aspx",
                    data: "name=" + $("#text1").val(),
                    success: function(msg) {
                        alert("Data Saved:" + msg);
                    }
                });
            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <span id="spa"></span>
        <input id="text1" type="text" name="username" />
        <input id="button1" type="button" name="btn" value="button" />
    </div>
    </form>
</body>
</html>
原文地址:https://www.cnblogs.com/Loyalty/p/2500773.html