Send ajax from view to controlelr, controller send back json and pagination suitable from json
this ini my problem.. i have a lot of data, example 1000 data, and i create pagination 15 data each page in table..
and i have 3 link to filter my data, this link send ajax string to my controller, and then my controller will send back json to my view..
but i have problem i cant replace my table to the json from my controller
this is my javascript
function filter($color)
{
var colors = {color:$color};
$.ajax({
url:'/filter',
type: 'POST',
headers:{"content-type" : "application/json"},
data: JSON.stringify(colors),
success: function(response) {
console.log(response.filter);
}
});
}
this is my controller
public function filter(Request $request)
{
$color = $request->color;
$arrFilter = array();
.
.
.
return response()->json(['filter' => $arrFilter]);
}
when i try to console.log in javascript its success..