这段代码是什么意思求详细解释,特别是function(data)是什么意思data从哪里来的

$.ajax({
async:false,
url :"${base}/dict/selectSubDictListByParentDictCode.shtml?dictCode="+parentDictCode,
type : "post",
cache : false,
dataType : "json",
error: function(){
alert('error');
},
success:function(data){
fillData(data);

}
});

炎炎设计
浏览 297回答 2
2回答

慕标5832272

$.ajax({async:false,url :"${base}/dict/selectSubDictListByParentDictCode.shtml?dictCode="+parentDictCode, //type : "post",cache : false,dataType : "json",error: function(){//这个就是访问失败的回调函数了。alert('error');},success:function(data){ //访问成功之后的回调函数, 也就是上边那个url成功访问之后会调用这个函数 data就是访问url返回的结果。fillData(data); // fillData这个函数应该是你自己定义的 具体要对返回结果做什么操作 你可以把alert(data); 看看具体返回的是什么东西}});

慕斯王

至于function(data)是什么意:success (Function) : 请求成功后回调函数。参数:服务器返回数据,数据格式。function (data, textStatus) {// data 可能是 xmlDoc, jsonObj, html, text, 等等...this; // 调用本次AJAX请求时传递的options参数}
打开App,查看更多内容
随时随地看视频慕课网APP