I use jquery ui autocomplete with a dynamic source:
$( "#shop-id" ).autocomplete({
source: function(request, response){
$.ajax({
type: "GET",
url: "/app_dev.php/ticket/get_sids/",
data: {
term: request.term
},
success: function(data){
console.log(data);
}
})
}
});
The produced url will look like this:
/app_dev.php/ticket/get_sids/?term=22
How do I handle that in symfony 2 routing? I tried several things but the question mark seems to be the bottle neck.
Any ideas?
term=22is a query parameter — a parameter that comes with aGETrequest. Symfony will not use this while checking the route, so it will try to find a route for/ticket/get_sids/. If you define a controller that handles this URL, then you can get thetermparameter like this: