I have these functions that allow me to get the roster on ejabberd server.
function callback(){
alert('hi');
}
function getInfo(){
var iq = $iq({type: 'get'}).c('query', { xmlns: Strophe.NS.ROSTER });
conn.sendIQ(iq, callback);
}
The request is a success since I have an alert. My question is how can I handle the response from the server ? I can see on Wireshark the following response :
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client'
from='azerty@localhost' to='azerty@localhost/24988088151432746377322003' id='4:sendIQ'
type='result'><query xmlns='jabber:iq:roster'>
<item subscription='both' jid='user1@localhost'><group>EveryBody</group></item>
<item subscription='both' jid='user2@localhost'><group>EveryBody</group></item>
<item subscription='both' jid='user2@localhost'><group>EveryBody</group></item>
</query></iq></body>
I would like to get a list with user1, user2, user3.
Any advice on how can I access at least the response like xhr ?
I've changed the callback function like this :
function callback(iq){
$(iq).find('item').each(function(){
var jid = $(this).attr('jid');
alert(jid);
});
}
Works well..