無論我嘗試什麼,我都無法在.ajax響應中找到XML節點。jquery .find()找不到xml節點
<?xml version="1.0" encoding="utf-8"?>
<ctatt>
<tmst>20121209 09:58:14</tmst>
<errCd>0</errCd>
<errNm />
<eta>
<staId>40970</staId>
<stpId>30188</stpId>
<staNm>Cicero</staNm>
<stpDe>Service toward Forest Park</stpDe>
<rn>105</rn>
<rt>Blue</rt>
<destSt>0</destSt>
<destNm>Forest Park</destNm>
<trDr>5</trDr>
<prdt>20121209 09:57:40</prdt>
<arrT>20121209 10:00:40</arrT>
<isApp>0</isApp>
<isSch>0</isSch>
<isDly>0</isDly>
<isFlt>0</isFlt>
<flags />
</eta>
</ctatt>
$(response).find('ctatt').find('eta').each(function(){});
將不會找到ela節點。它永遠不會進入每個循環。
$(response).find('ctatt').find('tmst')
或$(response).find('ctatt').find('errCd')
確實進入每個循環。我不明白爲什麼它不能解析$(response).find('ctatt').find('eta')
你從哪裏得到的是XML,你分析它爲XML與[** $ parseXML **](HTTP:/ /api.jquery.com/jQuery.parseXML/)? – adeneo