i have an api call the client side like
function doInBackground(){
$.get('car/get-map-data',
{
'params':'$params'
},
function(data){
if(data)
{
console.log(data);
}
});
}
$params is the search Params. And my server code is like
public function actionGetMapData($params){
$searchModel=new CarSearch();
$dataProvider=$searchModel->search($params);
$models=$dataProvider->getModels();
$mapData=array();
foreach ($models as $key => $model) {
array_push($mapData, $model->title);
}
return json_encode($mapData);
}
I have a page size of 10 in the search
$query = Car::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
]);
And here is my response of first call means first page of pagination
["Dodge Challenger | 2012 | GCC | Very Good Condition | Free Accidents","RALLYE \/ V4 \/ 2.4L \/\/\/ FULL OPTION \/\/\/ NEGOTIABLE","2015 FERRARI CALIFORNIA T CONVERTIBLE GCC SPECS IN PERFECT CONDITION UNDER SERVICE CONTRACT","V8\/HEMI\/5.7L \/\/\/ NEGOTIABLE \/\/\/ SRT KIT\/Monthly 825\/-","Ferrari F430 Scuderia","GCC \/ SRT \/ 6.4L\/ Agency maintained","Ford Focus","Dodge Charger \/ SXT \/ 3.6 LT \/ V6 \/","STUNNING FERRARI CALIFORNIA T \/\/ 2013 \/\/ GCC \/\/ FULL SERVICE HISTORY !!!","Ford Fiesta 2012, full service history, al tayer, big service already done"]
Now i am getting first 10 datas from the server.Now i want to iterate the same to get the all data page by page.How to do that iteration