easy UI datagrid 怎么接收后台的JSON 数据并显示
2个回答
展开全部
点击button调用getAll方法从数据库取数据
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("loadData",result);
}
});
};
result为返回的json字符串[{"address":"将军路","orderItemList":[{"id":180,"num":2,"price":40.0}],"status":0,"userId":16}]
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("loadData",result);
}
});
};
result为返回的json字符串[{"address":"将军路","orderItemList":[{"id":180,"num":2,"price":40.0}],"status":0,"userId":16}]
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询