點擊button調用getAll方法從數(shù)據(jù)庫取數(shù)據(jù)
jsp代碼:
<input type="text" class="txt">
<button onclick="getAll()">查詢</button><br/>
<table id="dg-order" ></table>
js代碼: function getAll(){
var text = $('.txt').val();
$.ajax({
url:basePath+"list/all",
data:{
userid:text,
},
success:function(result){
$('#dg-order').datagrid("loadDate",result);
}
});
};result為返回的json字符串[{"address":"將軍路","orderItemList":[{"id":180,"num":2,"price":40.0}],"status":0,"userId":16}]
從后臺取回的json數(shù)組,如何用easyui的datagrid顯示出來?
紫衣仙女
2018-10-18 13:10:03