简体   繁体   中英

Jquery xml for each loop not working in IE6

Slight nightmare. This works in every browser except IE in compatibility mode and IE6.

I've searched and searched and have no clue to why, can anyone shed any light?

$(document).ready(function () {

    $.ajax({
        type: "GET",
        url: "/Maps/MapResults.aspx",
        dataType: "XML",
        success: function (asd) {

            //This works!
            alert(asd);


            //This doesn't! (in old IE)
            $(asd).find("article").each(function () {

                var category = $(this).find('category').text();
                alert(category);

            });

        }
    }); //close $.ajax(

});

Let MapResults.aspx send and XML-Content-Type-Header (eg application/xml ). Also use lowercase-dataType "xml", it may depend on jQuery-Version if dataType is case-sensitive(I'm not 100% sure, but i think it was case-sensitive before 1.5)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM