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µÄ· ......
¼òµ¥µÄÃèÊöÏ DWR ÅäÖ㨱£ÃÜÐÒ飬Ôڴ˲»¹«¿ªÏîÄ¿Ãû³Æ£¬ÏîÄ¿Ïà¹ØÃû³ÆÈ«²¿ÓÃXXXX´úÌæ£©
Ê×ÏÈ ·Ï»°²»ËµÁË ´ó¼Ò¶¼Ó¦¸ÃÀí½âDWRµÄÓô¦ ²»¶®µÄÈ¥°Ù¶È
±ØÒª°ü DWR.JAR ¹Ù·½ÏÂÔØµØÖ·http://directwebremoting.org/dwr/download.html
Õâ¸öÏîÄ¿ÊÇÓÉ SSH+dwr+jquery+sitemesh+freemarker
WEB.XML
<!-- dwr -->
<serv ......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LeftMenu.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xht ......
×î½üÔÚ¸ºÔð×öÍøÕ¾µÄºǫ́¹ÜÀí²¿·Ö£¬¾õµÃjqueryµÄsortable×ö¶¯Ì¬¹¤¾ßÀ¸ºÜʵÓÃ,µ«ÍøÉϺܶ඼ֻ½éÉÜajaxºÍsortableÒ»Æð£¬Ã»ÓкÍdatabase½áºÏ×ÅÓã¬Î¨Ò»¿´µ½µÄ¾ÍÊÇÓÃcookie£¬Èç¹ûÓÐÅóÓÑϲ»¶ÓÃcookieµÄ£¬¿ÉÒÔÀ´ÕâÀï¿´¿´¡£ ÎÒ¸öÈ˲»Ï²»¶cookie£¬cookieÓÐʱ¼äµÄÏÞÖÆ£¬¶øÇҺöàÈËÏÖÔÚ¶¼½ûÖ¹cookieµÄʹÓÃÁË¡£¾Í×Ô¼º±àÁ˸öÂ룬ÓÃphp¡¢j ......
Struts2ÊÇjavaÔÚweb¿ª·¢Öг£ÓõĿò¼ÜÖ®Ò»£¬½ñÌìС±àÕûÀíÁËÒ»ÏÂ×ÊÁÏ£¬Ì¸Ì¸Struts2µÄAjaxÖ§³Ö¡£Struts2µÄAjaxÖ§³ÖÊǽ¨Á¢ÔÚDojoºÍDWR»ù´¡Ö®Éϵģ¬ÕâÁ½¸ö¿ò¼Ü¶¼ÌṩÁ˷dz£³ÉÊìµÄAjaxÖ§³Ö£¬°üÀ¨·Ç³£ÓÅÐãµÄÒ³Ãæ¿Ø¼þºÍ¼òµ¥µÄDOM²Ù×÷¡£ÆäÖÐDojoÌṩÁ˷ḻµÄ×é¼þ¿âºÍÒ³ÃæÐ§¹û£¬¶øÇÒÌṩÁË´óÁ¿µÄº¯ÊýÀ´¼ò»¯Ajax¹ý³Ì¡£DWR(Direct Web R ......