$.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);}});
2 回答

慕标5832272
TA贡献1966条经验 获得超4个赞
$.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); 看看具体返回的是什么东西
}
});

慕斯王
TA贡献1864条经验 获得超2个赞
至于function(data)是什么意:
success (Function) : 请求成功后回调函数。参数:服务器返回数据,数据格式。
function (data, textStatus) {
// data 可能是 xmlDoc, jsonObj, html, text, 等等...
this; // 调用本次AJAX请求时传递的options参数
}
添加回答
举报
0/150
提交
取消