Reputation: 9080
I have an xml string that I'm passing to a javascript function.
var t = $('<?xml version="1.0" ?><Messages><JCallBack ProgramName="x"><Value><![CDATA[top.closeCtrlLoading();]]></Value></JCallBack><RObject Type="E" Name="gH2ptObj_co_code" ChangeType="objProp" rowNum="" colNum=""><Property Name="value"><Value><![CDATA[]]></Value></Property></RObject></Messages>');
I was looking at this question to get the values of each of my nodes.
t.filter('Messages').each(function () {
alert($(this).find('RObject').text());
});
Here is my fiddle
I would like to get all the information out of each node in RObject as well as the children nodes inside of Robject (i.e. Property and Value).
My fiddle isn't quite correct yet. Can someone please advise what I have to do to get this working?
Upvotes: 0
Views: 3499
Reputation: 11044
You'll want to run $.parseXML() on your data before trying to process it.
Edit x2: See the updated, working, fiddle.
Upvotes: 4