2
我的AJAX功能如何從ajax響應中加載dhtmlx網格中的數據?
//my grid initialization is here
mygrid.init();
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WeeklyReportConfig.aspx/Showdata",
data: '{"idno":"' + emid + '"}',
dataType: "json",
success: function(result) {
for (var i = 0; i < result.d.length; i++) {
result = JSON.stringify(result[i]);
mygrid.load(result[i], JSON);
}
},
error: function(result) {
alert("Error");
}
});
我無法載入我的DHTMLX格但我正在逐漸從我的web方法的數據。
你應該可以在你的'success'函數中訪問'mygrid'就好了,你是說你不能?你能顯示你試過的實際代碼嗎? –
成功:function(result){ for(var i = 0; i
你能舉一個'result'的例子嗎?你爲什麼使用'stringify'?你爲什麼要通過'result.d'循環,而不是在循環內部使用'result.d [i]'? –