문제

I have the following XML that I am using in several functions in a web page that uses jQuery.

var msgXML = "<XMLInput><Source></Source><MessageText></MessageText><SendTime></SendTime><Destination></Destination></XMLInput>",
msgXMLDoc = $.parseXML(msgXML),
$msgXML = $( msgXMLDoc );

In a function that makes use of the above in order to set values, as shown below:

$msgXML.find("Source").append(newSource);
$msgXML.find("MessageText").append(NewMessageTxt);
$msgXML.find("SendTime").append(currDateTime);
$msgXML.find("Destination").append(newDest);
var newXML = $msgXML.children(0).get(0).outerHTML;

The last line above sets newXML with the outerHTML that I am then passing into another function (to write it into a table).

In Firefox, the last line works fine & a console.log of newXML shows the XML I expected to see. However, in both IE and Chrome, it returns Undefined. What do you need to do to be able to use the XML data that is in outerHTML in all 3 browsers?

Thanks!

올바른 솔루션이 없습니다

다른 팁

Use $msgXML.childNodes to get this work in all browsers.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top