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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    <input type="button" value="click" id="btn" />
    </form>
</body>
<script type="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
    $("#btn").click(function () {
        jQuery.ajax({
            type: "post",
            url: "ajax_model.aspx",
            data: "TYPE=SCRIPT",
            dataType: "script",
            success: function (mes) {
                //MES是获得返回的数据,可以通过dataType进行设置返的数据类型
                //if (mes == "Y") {
                //    alert("进入了switch的Y代码块");
                //} else {
                //    alert("进入了switch的default代码块");
                //}
                //document.write(mes);
            }
        });
    });
</script>
</html>

posted @ 2011-06-28 00:50  solomon_Blog  阅读(437)  评论(0编辑  收藏  举报