AjaxÎÞ·¨³¹µ×ɾ³ýSessionµÄÊôÐÔ
×î½üÔÚÓÃAjax×öµÇ¼´°¿Ú£¬µ«ÊÇlogoutµÄʱºòÐèÒª¶Ôsession½øÐд¦Àí¡£ÓõÄÊÇsession.removeAttribute()º¯Êý½øÐÐlogout¡£µ«ÊÇ£¬ÊÂʵ֤Ã÷£¬ÔÚlogoutÒÔºó£¬ÔٴεǼµÄʱºò£¬²¢²»Äܵǽ³É¹¦£¬Ñ¹¸ù²»»á½øÈëactionÖ´ÐÐÏàÓ¦µÄ·½·¨£¨hqlÓï¾äҲûÓÐÖ´ÐУ©¡£
Ϊ´Ë£¬¾Ý˵ÓÐÁ½ÖÖ·½·¨½â¾öÕâ¸öÎÊÌ⣺1.ÔÚÍ·ÎļþÖмÓÈëmetaµÄ´úÂ룻2.ÔÚurlºóÃæÉú³ÉÒ»´®Ã»ÓÐÒâÒåµÄËæ»úÊý¡£ÔÒòÊÇ£¬Ajax¶ÔÓÚÏàͬµÄÇëÇó²¢²»»á´Î´Î¶¼Ö´ÐС£
ÓÉÓÚÎÒÊÇͨ¹ýµ¯³ö´°¿Ú×öµÄµÇ¼£¬Òò´ËÓÃmetaµÄ·½·¨²»Ì«ÈÝÒ×£¨Ò²ÐíÊDZ¾ÈËÓÞ¶Û£¬²»µÃÒªÁ죩£¬ËùÒÔ¾ÍÓÃËæ»úÊý¶ÔÇëÇó½øÐГαװ”¡£ÏÂÃæÊÇÁ½ÖÖ·½·¨ºÍÏàÓ¦µÄ
·½·¨Ò»£º
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
·½·¨2£º
url = "xxx.jsp?"+Math.round(Math.random()*100)
ÎÒÓõķ½·¨ÊÇ
xmlHttp.open("get", "/loginAction.do?accountName=" + accountName + "&userPassword=" + userPassword + "&" + Math.round(Math.random()*100), true);
Ïà¹ØÎĵµ£º
ÓкܾÃÒ»¶Îʱ¼äÎÒµÄBLOGÉÏûÓгöÏÖAJAXÏà¹ØѶϢÁË£¬Ö÷Òªµ±È»ÊÇÒòΪ¾ø´ó²¿·ÖµÄÖØÐĶ¼·Åµ½ÁËSilverlightÉíÉÏ(¿ÉÔ¤ÆÚµÄδÀ´Ó¦¸ÃÒ²»áÊÇÈç´Ë)¡£
µ«ÓÉÓÚ¹¤×÷ÉϵÄÐèÒª£¬×î½ü»¹ÊÇ»ØÍ·¿´ÁËһϼ´½«ÍƳöµÄASP.NET Ajax Library...£¬Ë³±ãÕÒÁËÒ»ÏÂÍøÂçÉϵÄѶϢ£¬¿´Õâ¸ö̬ÊÆÎÒ²ÂÏëÓ¦¸Ã²»ÉÙASP.NET¿ª·¢ÈËÔ±ºöÂÔµôÁËÕâ¸öÆäʵÒѾbet ......
ÓÃstruts2+jquery+json+hibernate+ajax×öÁËÒ»¸öµÇ½µÄdemo¡£
1.jspÒ³Ãæ
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/x ......
¡¡¡¡ÔÚÉÏһƪÎÄÕÂÖУ¬ÎÒÃÇÌÖÂÛÁËÈçºÎͨ¹ýjavascript´ÓÒ»¸öÔ¶³ÌXMLÎļþÖÐÈ¡µÃÊý¾Ý¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«Ñ§»áÔõÑù¶ÔÊý¾Ý×÷¸ü¸´ÔӵĴ¦Àí¡£×÷Ϊһ¸öʾÀý£¬ÎÒÃÇ»á×¼±¸Ò»×éXMLÊý¾Ý£¬½«Êý¾Ý·Ö¸î³É¶ÀÁ¢µÄƬ¶Ï²¢ÒÔ²»Í¬µÄ·½Ê½Õ¹Ê¾ÕâЩƬ¶Ï£¨È¡¾öÓÚËüÃÇÊÇÈçºÎ±»±êʶµÄ£©¡£
¡¡¡¡ÕâƪÎÄÕÂÊǽ¨Á¢ÔÚÉÏһƪÎÄÕÂÖй¹ÔìµÄʾÀý´úÂëµÄ»ù´¡Ö®ÉÏ ......
ÎÄÕ³ö×Ô£ºhttp://www.cnblogs.com/QLeelulu/archive/2008/04/21/1163021.html
±¾ÎĵØÖ·: jQuery
Ajax È«½âÎö
±¾ÎÄ×÷ÕߣºQLeelulu
תÔØÇë±êÃ÷³ö´¦£¡
jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄÜ°ïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄÏ°¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼ ......
$.get()ºÍ$.post()·½·¨
$.get(url [,data] [,callback] [,type])
type£ºstringÀàÐÍ£¬·þÎñÆ÷¶Ë·µ»ØÄÚÈݵĸñʽ£¬°üÀ¨xml£¬html£¬script£¬json£¬textºÍ_default
»Øµ÷º¯ÊýÖ»ÓÐÁ½¸ö²ÎÊý£ºfunction(data,textstatus){....}
data:·µ»ØµÄÄÚÈÝ £ ......