Arul
Arul

Reputation: 131

Loading and showing the xml file and its content in Apache cordova?

I am using Apache cordova api for developing mobile application. I want to load the xml file and show the contents of xml file in a page of mobile app. Anyone please help me?

Upvotes: 0

Views: 63

Answers (1)

Aravin
Aravin

Reputation: 4108

Try like this.

$.ajax({
        type: "GET",
        url: "../your xml url here/",
        dataType: "xml",
        success: function (xml){    

            $(xml).find('a').each(function(){
                $.each(this.attributes, function(b, attr){
                     var name = attr.name;
                     var value = attr.value;
                    // do your operation here.
                });
             });        

        }, 
        error: function(model, xhr, options) { 
            alert("error");
        }
    });

Upvotes: 1

Related Questions