我正在进行jquery分页,我在Json Response中返回要在特定页面和其他支持绑定元素值中加载的数据。为此,我需要在每次点击时返回一个二维数组作为Json响应。我已经声明了二维数组并将其返回到下面,我认为这样做的方式需要纠正。
我的php页面中的代码:
header("Content-Type: application/json");
dataset array from which pagination will select the page data:
$data = array("a","b","c","d","e","f","g","h","i","j",);
2 dimensional array that I wish to return as response:
$response_multi = array(
$currentPage,
$hasNextPage,
$hasPreviousPage,
$maxPage,
$dataCount,
$dataResponse = array($pageSize),
$pageSize
);
######### variables and array within $response_multi array will be set and the return section is like ############
echo json_encode($response_multi );
它不起作用。有人请!提前致谢。 :)
答案 0 :(得分:0)
试试这个
$pageSize = array(1,2,3,4)
$response_multi[] = $currentPage;
$response_multi[] = $hasNextPage;
$response_multi[] = $hasPreviousPage;
$response_multi[] = $maxPage;
$response_multi[] = $dataCount;
$response_multi['dataResponse'] = $pageSize;
$response_multi[] = $pageSize;
echo json_encode($response_multi);