关于json里面的callback里面的东西
0.0那那个回调函数里面的东西要怎么写呢?后面应该有得讲吧?
0.0那那个回调函数里面的东西要怎么写呢?后面应该有得讲吧?
2016-12-28
$(function () {
$("#btnShow").bind("click", function () {
var $this = $(this);
$.getJSON('http://www.imooc.com/data/sport.json',function(data){//回调函数
$this.attr("disabled", "true"); //当前按钮禁用
$.each(data, function (index, sport) { //$.each(collection,callback) 迭代函数 具体用法找度娘
if(index==3)
$("ul").append("<li>" + sport["name"] + "</li>");
});
});
})
});举报