datatable no refreshes ajax call
datatable no refreshes ajax call
my project have many conditions,I made these search conditions into an object.
$(document).ready( function () {
var table = $('#orderTable').DataTable({
"sAjaxSource": "/manager/orderInquire",
"sAjaxDataProp": "",
"aoColumns": [
{"mData": null},
{"mData": "orderCode"},
{"mData": "buyer.userName"},
{"mData": "seller.userName"},
{"mData": "shop.name"},
{"mData": "orderPrice"},
{"mData": "orderCreateTime"},
{"mData": "goodsQuantity"},
{"mData": "orderState.stateName"},
{"mData": "orderPayType.paytypeName"},
{"mData": null}
],
});
$('#inquirebutton').on( 'click', function () {
var OrderInquire = {
"orderCode": $('#orderCode').val(),
"payType": $('#payType').val(),
"orderStates": $('#orderStates').val(),
"rextype": $('#rexApply').val(),
"createTimeStart": $('#createstart').val(),
"createTimeEnd": $('#createend').val(),
"payTimeStart": $('#paystart').val(),
"payTimeEnd": $('#payend').val(),
"deliveryTimeStart": $('#deliverystart').val(),
"deliveryTimeEnd": $('#deliveryend').val(),
"completeTimeStart": $('#completestart').val(),
"completeTimeEnd": $('#completeend').val()
};
$.ajax({
url: "/manager/orderInquire" ,
type : "POST",
data: OrderInquire,
});
});
});
First visit the page,datatable show all result in database. Then user clicks the button send var OrderInquire to url: "/manager/orderInquire". I expect controller will return the search result and refreshes datatable ,but datatable do not show new results
I do not know how to refreshes datatable
@RequestMapping(value = "/orderInquire")
@ResponseBody
public List<DsOrder> getOrder(@ModelAttribute OrderInquire orderInquire) throws Exception
{
orderList = orderService.findBySpecification(orderInquire);
return orderList;
}