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
Ïà¹ØÎĵµ£º
HTML source:
<p>
Name:
<input type="text" id="demoName"/>
<input value="Send" type="button" onclick="update()"/>
<br/>
Reply: <span id="demoReply"></span>
</p>
Javascript source:
var services = new dojox.rpc.Service({
target:"../dwr/j ......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript&quo ......
Struts2ÊÇjavaÔÚweb¿ª·¢Öг£ÓõĿò¼ÜÖ®Ò»£¬½ñÌìС±àÕûÀíÁËÒ»ÏÂ×ÊÁÏ£¬Ì¸Ì¸Struts2µÄAjaxÖ§³Ö¡£Struts2µÄAjaxÖ§³ÖÊǽ¨Á¢ÔÚDojoºÍDWR»ù´¡Ö®Éϵģ¬ÕâÁ½¸ö¿ò¼Ü¶¼ÌṩÁ˷dz£³ÉÊìµÄAjaxÖ§³Ö£¬°üÀ¨·Ç³£ÓÅÐãµÄÒ³Ãæ¿Ø¼þºÍ¼òµ¥µÄDOM²Ù×÷¡£ÆäÖÐDojoÌṩÁ˷ḻµÄ×é¼þ¿âºÍÒ³ÃæÐ§¹û£¬¶øÇÒÌṩÁË´óÁ¿µÄº¯ÊýÀ´¼ò»¯Ajax¹ý³Ì¡£DWR(Direct Web R ......
ÒÔǰ×öÁËЩajax£¬ÊÇÔÚ.net2.0¼ÓÉÏajax toolkit¿ª·¢µÄ¡£ÏÖÔÚÒª×÷Ϊһ¸öÏÖÓÐÍøÕ¾µÄ×ÓÕ¾µã¡£Ä¿Ç°µÄ3.5ϵͳ×Ô´ø3.5°æ±¾µÄajax£¬Ò²¾ÍÊÇSystem.Web.Extensions 3.5¡£Õâ¸öÔÚajax toolkit 1.0ÖÐÒ²ÊÇͬÑùµÄassemblyÃû×Ö£¬ÒÔÖÁweb.configÎļþ»á±¨´í£¬ËµÕÒµ½2¸öͬÑùµÄassembly¡£ÓÖ²»¿ÉÄÜÈ¥ÐÞ¸ÄÀÏÕ¾ÀïÃæµÄÎļþ£¬Ôõô°ìÄØ£¿ÎÒÃǼÈÏ£Íû±£Á ......