Parsing xml in jQuery

前端 未结 2 398
南旧
南旧 2021-01-17 03:48

I have this xml file:

    Response: 

        
2条回答
  •  无人及你
    2021-01-17 04:13

    Have you received this XML file via an XMLHttpRequest? If so, you can use its responseXML property.

    alert(xhr.responseXML.documentElement.getAttribute("statusLocation"));
    

    Or with jQuery:

    $.ajax({
        type: "GET",
        url: "yourfile.xml",
        dataType: "xml",
        success: function(xml) {
            alert(xml.documentElement.getAttribute("statusLocation"));
        }
    });
    

提交回复
热议问题