I have a Symfony app using a little bit of Javascript. There is a ajax request calling an API in Symfony:
$.ajax({
type: "POST",
url: "http://symfony.dev/api/price",
cache: false,
data: {
'volume': $('#tunnel_step_one_volume').val(),
'delivery': $('#tunnel_step_one_isStandardDelivery').val()
},
success: function (data, status) {
console.log(data);
Command.refreshData(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
})
Now the URL is hard coded.
My question is:
What is the best practices to give the JS file my route name in Symfony?