EazonLv
2018-08-04 14:55
$(function () {
$("#btnShow").bind("click", function (data) {
var $this = $(this);
$.get("https://www.imooc.com/data/info_f.php",function(){
$this.attr("disabled", "true");
$("ul").append("<li>我的名字叫:" + data.name + "</li>");
$("ul").append("<li>男朋友对我说:" + data.say + "</li>");
}, "json");
})
});
data是回调函数默认的参数,data取名字随意,这里是形参,data表示的就是服务器返回的json格式的数据。。
function(data)是执行click事件要出发的函数,跟调用函数差不多
jQuery基础(五)一Ajax应用与常用插件
69098 学习 · 416 问题
相似问题