简体   繁体   中英

Parsing xml with jQuery in IE6/7 issue

I have some problem with parsing XML in Ie6/7(original 7 no compatible mode). On Another normal browsers it works.

Jquery code:

$.ajax({
        type: "GET",
        url: "test.xml",
        dataType: "html",
        success: function(xml) {
            $(xml).find('quoteresult').each(function(){
                var bid = $(this).find('bid').text();
                alert(bid);
            });

        }
});

When I do alert(xml); I see all XML file even in IE6, but alert($(xml).html()); , In ie6 it is empty , in FF it works !!

I can't understand what is wrong !

Thanks

Make sure that your XML has no whitespace. As Firefox ignores it whereas IE6/7 breaks. You can add:

error: function(XMLHttpRequest, textStatus, errorThrown){ 
     alert(textStatus); 
}

to check for errors thrown back.

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