$.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
提交
取消