为了账号安全,请及时绑定邮箱和手机立即绑定

为啥ie下可以,火狐不行呢

为啥ie下可以,火狐不行呢,火狐显示未定义。。。

$(function () {
   $("#btnShow").on("click", function () {
       var $this = $(this);
       $.getJSON("data/sport.json", function (data) {
           $this.attr("disabled", "true");
           $.each(data, function (index,sport) {
              $("ul").append('<li>'+sport["name"]+"</li>");
           });
       })
   });
})


[{"name":"3"},{"name":"5"},{"name":"5"}]

http://img1.sycdn.imooc.com//5938fc770001ace403160224.jpg

http://img1.sycdn.imooc.com//5938fc770001db8903620258.jpg


正在回答

1 回答

搜了一段浏览器兼容代码,加上就可以了,

function gethttp(sid, url) {  

    var xmlHttp;  

    if (window.ActiveXObject) {  

        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  

    }  

    else if (window.XMLHttpRequest) {  

        xmlHttp = new XMLHttpRequest();  

    }  

  

    xmlHttp.onreadystatechange = function() {  

        if (xmlHttp.readyState == 4) {  

            document.getElementById(sid).innerHTML = xmlHttp.responseText;  

        }  

    }  

  

    xmlHttp.open("POST", url, true);  

    xmlHttp.send(null);  



0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为啥ie下可以,火狐不行呢

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信