簡體   English   中英

在IE 8中,Ajax請求似乎失敗了

[英]Ajax request seems to fail in IE 8

以下jQuery代碼從Met Office數據點返回一個xml文件,並應使用xml數據中的屬性提醒用戶: -

$.ajax({
            url: "http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/xml/324246?res=daily&key=myapikey",
            dataType: "xml",
            method: "GET",
            success: function (text) {
                myValue = $(text).find("Period Rep").first().attr("W");
                alert(myValue);
            },
            error: function () {
                alert("Not working");
            }
        })

這在Chrome中運行良好,並且符合我的預期,但在IE8中調用了錯誤函數。 我有什么想法,或者為什么IE不想工作?

(注意:我知道IE8遠非理想,但遺憾的是我不得不支持它。目前還沒辦法解決這個問題)

嘗試

jQuery.support.cors = true;

在請求和之前

crossDomain: true

作為ajax選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM