Установите переменную Twig из JavaScript
//Here is an example
<span id="editSchool" data-url="{{ path('_education_edit', {'id': id}) }}">
Edit School
</>
$('#editSchool').click(function () {
var url = $(this).data('url');
$('#educationDialog').load(url, function () {
$('.closeDialog, #person_education_form_cancel').click(function () {
$('#addSchool').trigger('click');
});
});
});
RemziStudios