AJAX´¦ÀíXMLÎĵµÎÊÌâ
<XML>
<FLAG>1</FLAG>
<REASON></REASON>
<ADVERT><ADID>64</ADID><ADNAME>Ó¢»ÊÓéÀÖËÄ</ADNAME><ADCONTENT>ÄÚÈÝÒ»</ADCONTENT><ADTIME>50.0</ADTIME></ADVERT>
<ADVERT><ADID>66</ADID><ADNAME>Ó¢»ÊÓéÀÖÈý</ADNAME><ADCONTENT>ÄÚÈݶþ</ADCONTENT><ADTIME>51.0</ADTIME></ADVERT>
</XML>
ÎÒÌá½»ÓõÄÊÇPOST·½·¨£¬ÈçÉÏÊÇÌá½»ºó·þÎñÆ÷¶Ë·µ»ØµÄXMLÎı¾£¬ÎÒͨ¹ýÏÂÃæ·½·¨À´»ñÈ¡ÎĵµÄÚÈÝ£¬£º
//AJAXÏìÓ¦´¦Àíº¯Êý
function doProcess(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
//´´½¨XML¶ÔÏó
var xmlDoc = xmlHttp.responseXML;//²âÊÔxmlDocÊǶÔÏó
//var testStr = xmlHttp.responseText;//testStr ¼´ÎªÉÏÃæ³öÏÖµÄXMLÎı¾
alert(xmlDoc.childNodes[0]);//µ«ÊÇËûµÄ×Ó½ÚµãΪnull
var flag = xmlDoc.getElementsByTagName("ADVERT");
alert(flag.length);//Êä³öΪ0£¬ÎªÊ²Ã´²»ÊÇ1
if(flag[0].firstChild.nodeValue==1){ //ÕâÀï¾ÍÖ±½Ó±¨´í˵¶ÔÏó²»´æÔÚÁË¡£¡£
var reason = xmlDoc.getElementsByTagName("REASON");
alert(reason[0].firstChild.nodeValue);
}
}
}
}
Çë°ïÎÒ·ÖÎöÏ£¬ÎªÊ²Ã´µÃµ½µÄ²»ÊÇÎÒÔ¤ÆÚµÄ½á¹û
ÿÌì»ØÌû¼´¿É»ñµÃ10·Ö¿ÉÓ÷Ö
ÊÔÊÔ
var xml = xmlDoc.documentElement;
alert(xml.childNodes.length);
2Â¥µÄ·½·¨ÎÒÓùýµÄ£¬Îª
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÓÃstruts2¿ò¼ÜÖÐÐèҪʹÓÃajaxʵÏÖ¾Ö²¿Ë¢Ð£¬µ«ÊÇ´ÓÈÝÆ÷Àï·µ»ØµÄÖµ²»ÖªµÀÔõô´Óstruts.xmlÅäÖÃÎļþÀïÓ³Éäµ½jspÒ³ÃæÀÒÔǰservletÀïдout.orint("xxxxx")¾Í¿ÉÒԵõ½~£¬µ«ÊÇÏÖÔÚÓÃstruts¾Í²»ÖªµÀÔõô ......
Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
<a>aaa
</a>
<b>bbb
</b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......
ÈçÌâ
ÄÄÖֵġ£ajax.dlla\ajaxpro.dll
´«Í³Ð´·¨¾ÍÊÇxmlhttphandle»¹ÊÇajax×é¼þ£¿
http://download.csdn.net/source/652519
È¥ÕâÀï¿´¿´°É£¬Ö÷ÒªÊÇÕë¶Ô²ËÄñºÍÐÂÊֵģ¬Èç¹ûÊǸßÊÖ¾ÍÁíµ±±ðÂÛÁË
×î¼òµ¥µÄ....
ÍÏ ......
ÈçºÎ¶ÔxmlÄÚÈÝÊý¾Ý½øÐбȽÏ
ÀýÈ磺
<?xml version='1.0' encoding='utf-8'?>
<TestLIST>
<PID>40</PID>
<TestName>ÉîÛÚÊÐ</TestName>
......
ÈçÌâ
ÇëÎÊÄܲ»ÄܸøµãÖ¸µã£¬¹ØÓÚÕâ¸ö¿ÎÌâÎÒ²»ÖªµÀ¸ÃÔõô׼±¸£¡
˵µÃÌ«¼ò½àÁË£¬²»Àí½â
Âò¼¸±¾xml»ù´¡µÄÊé¿´¿´
ÊǽâÎöxmlÂð£¿Èç¹ûÊÇ£¬½¨ÒéÏÈÓÃdom½âÎö£¬ÕÒµ½·½·¨ºó£¬¿ÉÒÔÖ±½ÓʹÓÃjquery½âÎö£¬½¨ ......