jeudi 7 mai 2015

parse xml response of web service using javascript and ajax

I need to parse the xml response returned by a web service in ajax, this is my code, 'response' is the response returned by the web service, how do i create a xml object and parse it?

$.ajax({
    type: 'POST',
    url: 'web service link',
    dataType: 'xml:lang',
    success: function (response) {
        // how to parse the response here
    },
    error: function (error) {
        console.log(error);
    }
});

This is my XML code:

<ArrayOfMobileConfiguration xmlns:xsd="http://ift.tt/1hQy46R"; xmlns:xsi="http://ift.tt/1hQy6vr"; xmlns="tempuri.org/">; 
    <MobileConfiguration> 
        <Id>1</Id> 
        <Key>STMaxDownloadSize</Key> 
        <Value>132000</Value> 
    </MobileConfiguration> 
    <MobileConfiguration> 
        <Id>2</Id> 
        <Key>ZoomingThresholdValue</Key> 
        <Value>14</Value> 
    </MobileConfiguration>
</ArrayOfMobileConfiguration>




Aucun commentaire:

Enregistrer un commentaire