Ò»¸öÆÊÎöAJAXÔÀíµÄ¼òµ¥·¶Àý
ΪÁËÈø÷ΪÄܹ»Á˽âʲôÊÇAJAX£¬ÒÔÏÂÊÇÒ»¸öAJAXµÄÊÖ¹¤·¶Àý£¨¼´²»ÒýÓÃÈκεÄLibrary»òAJAX
framework£©£¬´Ë·¶ÀýÆÄΪ¾«ÒªÒ׶®£¬Æä×÷ÓÃÖ÷ÒªÊÇ͸¹ýClient ¶ËµÄBrowserÀ´¼´Ê±¼à¿ØWeb ·þÎñÆ÷×ÊÔ´»òЧÄܱ仯£¬¸÷λֻҪ×ö¹ý
Ò»±é·¶Àý¾ÍÄܹ»Á˽âAJAXÔÚÍøÒ³¿ª·¢ÉÏÊǶàô¾ßÓÐÍþÁ¦ÁË¡£
ÏÈÀ´¿´¿´Ð§¹ûͼ£º
±¾·¶ÀýÊÇÒ»¸ö¼òµ¥µÄAJAXÀý×Ó£¬µ«ÂéȸËäСÎåÔà¾ãÈ«£¬¿ÉÓÉ´Ë¿ú¼ûÔʼAJAX·Çͬ¼¼ÊõÊÇÈçºÎÔË×÷¡£²»ÐèÒª°²×°ÈκÎÌØÊâµÄAJAXÌ×¼þ£¬²½Öè˵Ã÷ÈçÏ£º
Ò»¡¡½¨Á¢WebÏîÄ¿
Ê×ÏÈÔÚVS 2005£¨»òVS.NET 2003£©½¨Á¢Ò»¸öÆÕͨµÄWEBÏîÄ¿£¬»òÕßÄúûÓÐVS¿ª·¢¹¤¾ß£¬Ö±½ÓÓüÇʱ¾½¨Á¢Ò²ÐС£
¶þ¡¡½¨Á¢Client¶ËÒ³Ãæ
ÔÚWebר°¸ÖмÓÈëÒ»¸öClient¶ËÒ³ÃæClient.htm£¬²¢½«´ËÒ³ÃæÉ趨ΪÆðʼҳ£¬Õâ¸öÒ³Ãæ»áÏòWebËÅ·þÆ÷ÍøÒ³·¢³ö·Çͬ²½ºô½ÐÇëÇ󣬲¢ÇÒ½«ËÅ·þ
Æ÷»Ø´«×ÊÁϸüе½ÍøÒ³ÔªËØÖУ¬´úÂëÈçÏ£º
<!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¶Ë´¦Àí³Ìʽ
ÁíÍâÔÚר°¸ÖмÓÈëÒ»¸öServer.aspxÍøÒ³£¨º¬.cs£©£¬Server.aspx²»ÐèÒªÌí¼ÓÈκδúÂë¡£
Server.aspx.cs ³ÌÐòÂëÈçÏ£º
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&
Ïà¹ØÎĵµ£º
·þÎñÆ÷¶ËÏìÓ¦Îļþpostalcode.jsp
·þÎñÆ÷ÏìÓ¦Îļþ¸ù¾ÝÓû§ÊäÈëµÄÓÊÕþ±àÂ룬´ÓÊý¾Ý¿âÖвéѯ¶ÔÓ¦µÄµØÇøÐÅÏ¢¡£Èç¹ûûÓÐÈ¡µ½£¬Ôò·µ»Ø¿Õ×Ö·û´®¡£
<%@ page contentType="text/plain; charset=UTF-8"%>
<%@ page language="java"%>
<%@ page import="java.sql.*,ajax.db.DBUtils"%>
<%!
......
AjaxµÄÔÀí¼òµ¥À´ËµÍ¨¹ýXmlHttpRequest¶ÔÏóÀ´Ïò·þÎñÆ÷·¢Òì²½ÇëÇ󣬴ӷþÎñÆ÷»ñµÃÊý¾Ý£¬È»ºóÓÃjavascriptÀ´²Ù×÷DOM¶ø¸üÐÂÒ³Ãæ¡£ÕâÆäÖÐ×î¹Ø¼üµÄÒ»²½¾ÍÊÇ´Ó·þÎñÆ÷»ñµÃÇëÇóÊý¾Ý¡£ÒªÇå³þÕâ¸ö¹ý³ÌºÍÔÀí£¬ÎÒÃDZØÐë¶Ô XMLHttpRequestÓÐËùÁ˽⡣
XMLHttpRequestÊÇajaxµÄºËÐÄ»úÖÆ£¬ËüÊÇÔÚIE5ÖÐÊ×ÏÈÒýÈëµÄ£¬ÊÇÒ»ÖÖÖ§³ÖÒì²½ÇëÇóµÄ¼¼Êõ¡ ......
´Ó2005 ÄêWeb2.0 µÄÐËÆð¿ªÊ¼ËãÆð£¬Ajax °éËæ׏úÄÚµÄWeb ¿ª·¢ÉçÇø×ß¹ýÁ˽üËÄÄêµÄ³É³¤Ê±¼ä¡£ËÄÄêµÄʱ¼ä£¬¶ÔÓÚÒ»ÏîWeb ¼¼Êõ²»Ëã¶ÌÁË£¬Õâ²»½öÊǶԵ±³õ¶ÔAjax“¾ÉƿװоƔ³Ö²»Ð¼Ì¬¶ÈµÄÈ˵ķ´²µ£¬¸ü°Ñ¸ü¶à¹ÛÍûÖеĿª·¢ÕßÀÈëÁËWeb ¿ª·¢µÄÐÐÁС£
AjaxµÄ¿ò¼ÜÒ²¿ªÊ¼Ò»Ò»³öÏÖ£º
Buffalo ÊÇÏÖÈÎThought ......
VS2005ÖÐajax°²×°Ö¸ÄÏ
ÒÔÏÂÊÇÊÕ¼¯¹ØÓÚAjaxControlToolkit°²×°µÄһƪÎÄÕ£¬¸ÐлÔ×÷Õß
AjaxControlToolkitÏÂÔØhttp://ajax.asp.net/downloads/default.aspx?tabid=47
http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425
»·¾³ÉèÖÃÈçÏ£º
ÏÂÔØÍê
ASPAJAXExtSetup.msi ° ......
×î½üÔÚ¸ºÔð×öÍøÕ¾µÄºǫ́¹ÜÀí²¿·Ö£¬¾õµÃjqueryµÄsortable×ö¶¯Ì¬¹¤¾ßÀ¸ºÜʵÓÃ,µ«ÍøÉϺܶ඼ֻ½éÉÜajaxºÍsortableÒ»Æð£¬Ã»ÓкÍdatabase½áºÏ×ÅÓã¬Î¨Ò»¿´µ½µÄ¾ÍÊÇÓÃcookie£¬Èç¹ûÓÐÅóÓÑϲ»¶ÓÃcookieµÄ£¬¿ÉÒÔÀ´ÕâÀï¿´¿´¡£ ÎÒ¸öÈ˲»Ï²»¶cookie£¬cookieÓÐʱ¼äµÄÏÞÖÆ£¬¶øÇҺöàÈËÏÖÔÚ¶¼½ûÖ¹cookieµÄʹÓÃÁË¡£¾Í×Ô¼º±àÁ˸öÂ룬ÓÃphp¡¢j ......