<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JqueryAjax.aspx.cs" Inherits="XXX.WebApp.JqueryAjax" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../Js/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(function() {
$("#btnAjax").click(function () {
$.ajax({
type: "POST",
url: "GetDate.ashx",
data: "name=John&location=Boston",
success: function (msg) { //回调函数,msg是服务器返回的数据
alert("Data Saved: " + msg);
}
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" value="AJAX获取数据" id="btnAjax" />
</div>
</form>
</body>
</html>