I managed to get the response from the prosody XMPP server. As a result, I got the iq stanza for my roster query.
<iq xmlns="jabber:client" id="1:sendIQ" type="result" to="server@localhost/c38649b9-b47f-46b9-bcbc-7f0f683408f1">
<query xmlns="jabber:iq:roster" ver="41">
<item jid="sam@internal" subscription="none"/>
<item jid="[email protected]" subscription="none"/>
<item jid="blade@internal" subscription="none"/>
</query>
</iq>
I want to get the value of JID from the item tag. For instance, sam@internal from the item tag.
so far I successfully reached to item tag by using below javascript code. But I want to traverse to "jid".
$(iq).find("query").children().each(function () {
alert(this.nodeName + ' = ' + $(this).text());
});
here is the running code on jsfiddle: http://jsfiddle.net/ritter17/ec272rux/
Any help would be appreciated!! Thanks in advance.
$(iq)
should be$('iq')
, and there's no "list" element to find in that stanza. – Andy