摘要:jQuery Ajax GetServerTime
$(function () {
//this code is executed when the page's onload event fires
$("a#runSample1").click(function () {
$.get("GetServerTime.aspx", function (response) { // 直接取得GetServerTime.aspx RESPONSE的值
alert(response);
});
});
html :
<a href="#" id="runSample1">Get Server Time</a>
GetServerTime.aspx .cs
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = -1; //required to keep the page from being cached on the client's browser
Response.ContentType = "text/plain";
Response.Write(DateTime.Now.ToString());
Response.End();
}
\\