开发者

Parsing xml with jQuery in IE6/7 issue

开发者 https://www.devze.com 2022-12-22 20:48 出处:网络
I have some problem with parsing XML in Ie6/7(original 7 no compatible mode). On Another normal browsers it works.

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);
            });

        }
});开发者_如何学JAVA

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消