Java 如何使用返回Spring MVC+;休眠RESTfulWeb服务?
我想用SpringMVC返回的JSON对象填充JQuery表。 我的JSON数据格式是Java 如何使用返回Spring MVC+;休眠RESTfulWeb服务?,java,jquery,json,spring,spring-mvc,Java,Jquery,Json,Spring,Spring Mvc,我想用SpringMVC返回的JSON对象填充JQuery表。 我的JSON数据格式是 { availDate: 1421508979000 custName: "Navin" custMobile: "8765432468" custEmail: "abc@gmail.com" custAddress: "BAngalore" } 我获取数据的服务url为 但是我的代码不起作用,请检查一下 <!DOCTYPE html> <html> <
{
availDate: 1421508979000
custName: "Navin"
custMobile: "8765432468"
custEmail: "abc@gmail.com"
custAddress: "BAngalore"
}
我获取数据的服务url为
但是我的代码不起作用,请检查一下
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"> </script>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css">
<script>
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://localhost:8080/HomeServiceProvider/booking/getAllBookingDetails" // for you it will be - /getWidgetsByType
} );
} );
</script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>availDate</th>
<th>custName</th>
<th>Office</th>
<th>custMobile</th>
<th>custAddress</th>
</tr>
</thead>
</table>
</body>
</html>
$(文档).ready(函数(){
$('#示例')。数据表({
“bProcessing”:正确,
“bServerSide”:正确,
“sAjaxSource”:http://localhost:8080/HomeServiceProvider/booking/getAllBookingDetails“//对于您来说,它将是-/getWidgetsByType
} );
} );
有效
客户名称
办公室
卡斯特莫比尔
客户地址
在数据表中添加列名及其各自的数据(JSON键值):
"columns" : [ {
"mData" : "availDate",
"bSortable" : true
}, {
"mData" : "custName",
"bSortable" : true
}, {
"mData" : "custMobile",
"bSortable" : true
}, {
"mData" : "custEmail",
"bSortable" : true
}, {
"mData" : "custAddress",
"bVisible" : false
}]
检查列的用法