Search code examples

Parsing XML with JQuery & Javascript

I am attempting to parse XML to grab the value with delivery=streaming via Jquery and Javascript, and I am coming up short.

How can I do this with some Jquery code? I feel I'm so close, yet so far.

    <MediaFile delivery="progressive" bitrate="3253252" type="video/mp4"><![CDATA[ https://file.mp4 ]]></MediaFile>
    <MediaFile delivery="streaming" bitrate="3253252" type="application/x-mpegURL"><![CDATA[ https://playlist.m3u8 ]]></MediaFile>
            type: 'get',
            url: '' + new Date().getTime(),
            datatype: "xml",
            success: function(data) {
                var mediaFiles = [];
                $(data).find("MediaFile").each(function() {


  • You have a typo in the datatype; it should be dataTypeinstead.

    And, since you want to filter mediafiles with delivery="streaming", you can use this: