简单的AJAX手工范例
Client端
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="javascript">
var XmlHttp=new ActiveXObject("Microsoft.XMLhttp");
function sendAJAX()
{
XmlHttp.Open("POST","Server.aspx",true);
XmlHttp.send(null);
XmlHttp.onreadystatechange=ServerProcess;
}
function ServerProcess()
{
if (XmlHttp.readystate==4 || XmlHttp.readystate=='complete')
{
document.getElementById('nameList').innerHTML =XmlHttp.responsetext;
}
}
setInterval('sendAJAX()',1000);
</script>
</head>
<body>
<div id="nameList"></div>
</body>
</html>
另建一页面Server.aspx,Server端
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
public partial class Server : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
PerformanceCounter myMemory = new PerformanceCounter();
myMemory.CategoryName = "Memory";
myMemory.CounterName = "Available KBytes";
string txtResult = "-->服务器可用内存大小:" + myMemory.NextValue().ToString();
Response.Write(DateTime.Now.ToLongTimeString() + txtResult);
}
}
Syst
相关文档:
jsp内置对象:
page --java.lang.Object
request --javax.servlet.http.HttpServletRequest
session --javax.servlet.http.HttpSession
application --javax.servlet.ServletContext
response --javax.servlet.http.HttpServletRes ......
1.记住下面三句话:
<1>异步应用程序是用JavaScriptt对象作出请求,而不是提交表单
<2>请求与响应是由Web浏览器处理,而不是直接由JavaScript代码处理
<3>一旦Web浏览器得到异步请求的响应,它会以服务器的响应“回头调用”JavaScript代码(这 ......
AJAX无疑是2005年炒的最热的Web开发技术之一,当然,这个功劳离不开Google。我只是一个普通开发者,使用AJAX的地方不是特别多,我就简单的把我使用的心得说一下。(本文假设用户已经具有JavaScript、HTML、CSS等基本的Web开发能力)
[AJAX介绍]
Ajax是使用客户端脚本与Web服务器交换数据的Web应用开发方法。Web页 ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<meta http-equiv="Content-Type" content="text/html; ......
<html>
<head>
<title>jQuery Ajax 实例演示</title>
</head>
<script language="javascript" src="../lib/jquery.js"></script>
<script language="javascript">
$(document).ready(function ()
{
$('#send_ajax').click(function (){
  ......