qq_清风徐_03895465
2016-12-28 23:12
0.0那那个回调函数里面的东西要怎么写呢?后面应该有得讲吧?
$(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>");
});
});
})
});
var $this = $(this);这句什么意思呀
回调函数function (index, sport)中的sport是形参吗?可以不用叫sport对吧
有 回调函数
jQuery基础(五)一Ajax应用与常用插件
69098 学习 · 416 问题
相似问题