2013-10-07 54 views
0

如何將ajax結果綁定到jqxGrid?我很困惑如何以正確的方式做到這一點,因爲在jqxGrid示例中,它們的源代碼只是一個文本文件。任何人都可以給我的想法去做正確的方式將是一個很大的幫助如何將ajax結果綁定到jqxGrid

截至目前這裏是我的Ajax代碼返回結果

$.ajax({ 
     type: 'post', 
     url: 'ws.asmx/GetStudentsById', 
     contentType: 'application/json; charset=utf-8', 
     dataType: 'json', 
     data: JSON.stringify({ 
      studID: id 
     }), 
     success: function (data) { 
var toAppend ='<table>'; 
$.each(data, function (key, val) { 
for (var i = 0; i < val.length; i++) { 
    toAppend+='<tr>'; 
    toAppend+='<td>'+val[i]['StudID']+'</td>'; 
    toAppend+='<td>'+val[i]['StudName']+'</td>'; 
    toAppend+='</tr>'; 
} 
toAppend += '</tbody></table>'; 
      }); 
$('#results').append(toAppend); 
     } 

});

在成功之下,我想將其更改爲jqxGrid,我不知道該如何啓動它。謝謝

回答

相關問題