AJAX ÎÞË¢ÐÂ
ICallbackEventHandler
aspx Ò³Ãæ£º
function CallServer(PhotoId)
{
document.getElementById("updatediv").style.display = "block";
document.getElementById("txtPhotoID").value = PhotoId;
var product = document.all("txtPhotoID").value;
<%= ClientScript.GetCallbackEventReference(this, "product", "ReceiveServerData",null)%>;
}
function ReceiveServerData(PhotoInfo)
{
if(PhotoInfo!="")
{
var result="";
var str=PhotoInfo;
var Photo=str.split("^&^");
for(i=0;i<Photo.length;i++)
{
result += Photo[i];
}
document.getElementById("txtPhotoName").value=Photo[0];
document.getElementById("txtPhotoDescr").value=Photo[1];
}else{("ÇëÑ¡ÔñÐèÒªÐ޸ĵÄÏàÆ¬£¡");}
}
.cs Ò³Ãæ
string ICallbackEventHandler.GetCallbackResult()
{
return Server.UrlDecode(CallBackValue)+"^&^"+Server.UrlDecode(CallPhotoColltion);
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
int PhotoID = int.Parse(eventArgument);
PhotoInfo = Photo.GetModel(PhotoID);
string PhotoName = PhotoInfo.PhotoName;
CallBackValue = Server.UrlDecode(PhotoName);
string PhotoIntroduction = PhotoInfo.PhotoIntroduction;
CallPhotoColltion = Server.UrlDecode(Phot
Ïà¹ØÎĵµ£º
£¨×ªÌû£©
¡¡¡¡Ò»Ìáµ½ÈçºÎÔÚǰ̨JSµ÷Óúǫ́C#·½·¨£¬AJAX³ÉΪÁ˱ØÈ»µÄÏë·¨¡£
¡¡¡¡Ö»ÊÇʵÏÖµÄϸ½Ú²ÉÓÃAJAX 1.0»òÕßAjaxProµÄÇø±ð¡£
¡¡¡¡ÆäʵÈç¹û²»ÓÃAJAX£¬ÎÒÃÇÒ²Äܹ»ºÜ·½±ãµØÀûÓÃJSµ÷Óúǫ́·½·¨¡£
¡¡¡¡²½ÖèÈçÏ£º
¡¡¡¡1 ǰ̨·ÅÒ»¸ö°´Å¥¡£ÉèÖÃΪÒþ²Ø¡£×¢Ò⣺²»ÄÜÖ±½ÓÉèÖÃVisible=falseµÄ· ......
½ñÌìÎÒÖ÷ҪѧϰÁËUpdateModeÊôÐÔ¼°Ê¹ÓÃUpdateTriggers£¬°ÑÊéÖÐËù½ÌÊÚµÄÄÚÈÝÓöà¸öÀý×Óʵ¼ùÁËһϣ¬È·ÊµÃ÷°×ÁËÐí¶à¡£
UpdateMode
Ê×ÏÈÔÚÉÏһƪҲÌáµ½¹ýÕâÑùÒ»¸öÀíÂÛ£ºÔÚ̸ÂÛUpdatePanel¿Ø¼þµÄË¢ÐÂʱ£¬µ±UpdatePanel¿Ø¼þÖеÄ×ӿؼþ´¥·¢Async-Postback¶¯×÷ʱ£¬Ë¢ÐµÄÇøÓòÊ ......
AjaxSuggest.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AjaxSuggest.aspx.cs" Inherits="AjaxSuggest" %>
<!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/199 ......
Ajax ÓÉ HTML¡¢JavaScript™ ¼¼Êõ¡¢DHTML ºÍ DOM ×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ Web ½çÃæ×ª»¯³É½»»¥Ð﵀ Ajax Ó¦ÓóÌÐò¡£¶ÔÓÚAjax£¬×îºËÐĵÄÒ»¸ö¶ÔÏóÊÇXMLHttpRequest£¬ËùÓеÄAjax²Ù×÷¶¼Àë²»¿ª¶ÔÕâ¸ö¶ÔÏóµÄ²Ù×÷¡£
Ê×ÏÈÎÒÃÇÀ´Á˽âÔõôÔÚjavascriptÖд´½¨Õâ¸ö¶ÔÏó£º
var xmlHttp = new ......
Struts2ÊÇjavaÔÚweb¿ª·¢Öг£ÓõĿò¼ÜÖ®Ò»£¬½ñÌìС±àÕûÀíÁËÒ»ÏÂ×ÊÁÏ£¬Ì¸Ì¸Struts2µÄAjaxÖ§³Ö¡£Struts2µÄAjaxÖ§³ÖÊǽ¨Á¢ÔÚDojoºÍDWR»ù´¡Ö®Éϵģ¬ÕâÁ½¸ö¿ò¼Ü¶¼ÌṩÁ˷dz£³ÉÊìµÄAjaxÖ§³Ö£¬°üÀ¨·Ç³£ÓÅÐãµÄÒ³Ãæ¿Ø¼þºÍ¼òµ¥µÄDOM²Ù×÷¡£ÆäÖÐDojoÌṩÁ˷ḻµÄ×é¼þ¿âºÍÒ³ÃæÐ§¹û£¬¶øÇÒÌṩÁË´óÁ¿µÄº¯ÊýÀ´¼ò»¯Ajax¹ý³Ì¡£DWR(Direct Web R ......