I'm trying to make an ajax call on tr click like this:
$.ajax({
type: "GET",
url: "/segments/ajaxGetHostsSegment",
data: {
deelgebied: deelgebiedid
},
success: function( data ) {
// CHECK ID'S WITH ID'S IN FORM AND CHECK CHECKBOXES
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
}
})
In my routes file I have:
$app->get('/segments/ajaxgethostssegment', 'Segments\Controller\IndexController::ajaxGetHostsSegment')->bind('segments.gethosts');
My Controller action:
public function ajaxGetHostsSegment(Application $app, Request $request)
{
$deelgebied = $request->request->get('data');
var_dump($deelgebied);
die();
}
But I always get the error:
No route found for "GET /segments/ajaxGetHostsSegment" (from "http://mext-pst.localhost:8080/segments/view/PSS1400023")