私は次のコードを持っています:
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else // for older IE 5/6
{
xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
}
var url = 'payment/code/xmlrelay.php?t=rates&id=' + str;
xmlHttp.open('GET', url, false);
xmlHttp.send();
xmlDoc = xmlHttp.responseXML;
xmlResult = xmlDoc.getElementsByTagName('Result')[0].firstChild.nodeValue;
Webサーバーから次の空のXMLファイルにアクセスする:
<?xml version="1.0" encoding="UTF-8"?><Property><Result>0</Result></Property>
または次の完全なもの:
<?xml version="1.0" encoding="UTF-8"?>
<Property>
<Result>1</Result>
<Rateable>1</Rateable>
<Location>123 Main Road, Everytown</Location>
<Instalment>$100.00</Instalment>
</Property>
これはFirefox、Chrome、Safari、Operaで機能しますが、Internet Explorer 8では、次の行に「オブジェクトが必要です」というエラーが返されます。
xmlResult = xmlDoc.getElementsByTagName('Result')[0].firstChild.nodeValue;
私は周りを検索しましたが、うまくいくものを見つけることができました。任意の提案をいただければ幸いです。
乾杯多摩