I have the following javascript:
function getMessageFromXML(xml) {
alert('xml: ' + xml);
alert("Text of message: " + $(xml).find('dataModelResponse').find('adminMessage').text());
return $(xml).find('dataModelResponse').find('adminMessage').text();
}
which runs in the following XML:
<dataModelResponse>
<adminMessage>BARF</adminMessage>
<adminData>
<identifier>123456</identifier>
</adminData>
</dataModelResponse>
I know that XML is correctly transmitted due to the first warning, but for some reason the message appears as empty. I checked that there was exactly 1 message and 1 dataModelResponse element in xml using the .length modifier for find () queries like this, but for some reason I cannot get it to print the correct message.
Suggestions?
EDIT: Changed the name of the tag I was looking for. Posted between the two versions, sorry.
source
share