I have an eCommerce shop where I have to filter products by its categories.
I have to post an array of all filters in the controller, but I am getting this error
"message": "",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",
"file": "C:\\xampp\\htdocs\\web_front\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RouteCollection.php",
"line": 179
Here is my code:
<script>
$(document).ready(function () {
var categories = [];
$('input[name="cat[]"]').on('change', function (e) {
e.preventDefault();
categories = []; // reset
$('input[name="cat[]"]:checked').each(function()
{
categories.push($(this).val());
});
$.ajax({
type:"GET",
url:'advanced_filter/' + categories,
success:function(data){
console.log(data);
},
error: function(xhr,errmsg,err)
{
console.log(xhr.responseText);
}
});
});
});
</script>
web.php
Route::get('advanced_filter/{filters}', 'HomepageController@advanced_filter')->name('advanced_filter');
public function advanced_filter($filters)
{
dd($filters);
}
I am trying to show all the filters, so I can make a query to get all the products based on filters. I have created the script where I get all filters and want to post it in the controller. Please, can you see this? Thank you