再会,
e.g: $transactions->links();
在 laravel 上进行 ajax 调用时如何通过?
这是我的控制器在正常请求下:
$transactions = DB::table('x_general_transactions')
->whereBetween('x_general_transactions.date_at', array($startDate,$endDate))
->paginate(30);
看法
{{ $transactions->(array('from' => $startDate, 'to'=>$endDate))->links() }}
并根据 ajax 请求
if (Request::ajax())
{
//$divs is my data container
$res = [$divs,$transactions->links()];
return Response::json($res);
}
所以当我尝试.load
在我的 ajax 代码上使用时
$.ajax({
url: href,
type: 'get',
dataType: 'json',
success: function(response){
$('.pagination').load(response[1]);
});
});
但是什么也没发生,我也试过
console.log(response[1]);
阿贾克斯响应:
[[[{"gt_xid":1230,"gts_xid":1231,"xid":4728,"rnr":4,"code":"OR#","link_code":"CI#","link_rnr":6,"g_type":25,"account_name":"Cash on Hand","debit":50.5,"credit":0,"description":"","date_at":"2015-10-25 16:25:19"},{"gt_xid":1230,"gts_xid":1231,"xid":4729,"rnr":4,"code":"OR#","link_code":"CI#","link_rnr":6,"g_type":25,"account_name":"Accounts Receivable - Trade","debit":0,"credit":50.5,"description":"","date_at":"2015-10-25 16:25:19"}]],{}]
result:
对象 {}` 是空的。