jqueryµÄAJAXÓöµ½ÎÊÌâ - Web ¿ª·¢ / Ajax
ÎÒÏÖÔÚÓöµ½Õâô¸öÎÊÌ⣬¾ÍÊÇÎÒÏÈÑ¡ÔñÒ»¸öÏÂÀÁÐ±í£¬È»ºó´¥·¢ÁËAJAXÀ´»ñÈ¡Êý¾Ý¿âµÄÊý¾Ý£¬ÎÒ½«·µ»ØµÄÊý¾Ý·Åµ½ÏÂÀÁбíÀȻºóÓÃinnerHTML²åÈëµ½Ò»¸ö<span>ÖУ¬¿ÉÊÇÎÒÔÚÑ¡ÔñÕâ¸öÐÂÉú³ÉµÄÏÂÀÁбíʱ£¬ÎÒ»¹ÏëÔÙ´¥·¢Ò»¸öajax£¬Ëû¾Í²»´¥·¢ÁË
ÔÚÐÂÉú³ÉµÄÏÂÀÁбíÖÐÌí¼ÓÒ»¸öonchangeʼþÀ´´¥·¢ÄãµÄajax
Óеģ¬¿É¾ÍÊDz»´¥·¢£º
JScript code:
$("#cid").change( function () {
var $cid = $("#cid option:selected").val();
$.get("main.php", { action: "listGrp", type: "Group", cid: $cid },
function(data){
alert(data);
//$('#flag').html(data);
});
});
¿´À´ÕæÈçÎÒËùÔ¤ÁϵĹýÕæÈç´Ë£¬innerHTMLºóµÄ¶¯Ì¬ÏÂÀ<select>ÄÚÈÝ£¬jqueryû·¨»ñÈ¡µ½jquery¶ÔÏóÁË£¬µ«ÊÇʹÓÃ$('#option').after(data);ÕâÖÖ·½·¨Ð´Èë<select>ÄÚÈÝÊÇ¿ÉÒÔ»ñÈ¡µÄ£¬É¢·Ö
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÓиöÃÅ»§ÍøÕ¾£¬ÓÃStruts1.2×öµÄ£¬Ö®Ç°Ã»ÓÃajax,ÏÖÔÚÏë½áºÏajax ¿ò¼Ü ÕûºÏÉý¼¶¡£
Struts1.2 ºÍÄǸöajax ¿ò¼ÜÕûºÏµÄ±È½ÏºÃ¡£ÕûºÏÖ®ºóÌý˵ajax Õ¼ÄÚ´æʲô¶¼²»Ð¡£¬°üÒ²²»Ð¡£¬´ó¼ÒÌÖÂÛһϰ¡¡£
ajax ÊÇ¿Í»§¶ËµÄ¶ ......
<script language="javascript">
var XMLHttpReq;
var cont=true;
//´´½¨XMLHttpRequest¶ÔÏó
function createXMLHttpRequest ......
ÎÒÔÚÒ»¸öhtmlÖÐдÈçÏ´úÂ룺
JScript code:
<html>
<head>
<script type="text/javascript" charset="utf-8"
src="script/jquery-1.3.2.min ......
ÎÒÓÃjqueryÎÞË¢ÐÂÉÏ´«Í¼Æ¬ºó·µ»Øjson¸ñʽµÄÊý¾Ý±¨´í
£¨Êµ¼ÊÉÏͼƬÊÇÉÏ´«³É¹¦µÄÁË£¬Ö»ÊÇ·µ»Øjson¸ñʽ×ܶÁ²»µ½£¬×ÜÊDZ¨´í£©
ÎÒµ÷ÊÔÉÏ´«µÄashxÒ³ÈçÏÂ
ÎÞ·¨ÏÔʾ XML Ò³¡£
ʹÓà Ñùʽ±íÎÞ·¨²é¿´ XML ÊäÈë¡£Çë¸ü ......
ÎÒÔÚʹÓ÷Óɹ¦ÄÜʱ£¬Óöµ½ÆäÓëajax¿ò¼ÜÆð³åÍ»µÄÎÊÌ⣬²»ÖªµÀÓÐûÓиßÊÖ¿ÉÒÔ·ÖÏí½â¾ö¾Ñ飿»òÌṩ½â¾ö·½°¸¡£ÔÚ´ËÏÈл¹ý¡£¡£¡£
C# code:
IHttpHandler IRouteHandler.GetHttpHandler(RequestContext requestConte ......