In my Ajax I'm receiving data:
$.ajax({
type: "GET",
url: Routing.generate('index', {page}),
success: function (data) {
console.log(data.data[0].isbn);// print expecting value well
$('#foo').append("<a href=\"{{ path('foo', { 'id': data.data[0].isbn }) }}\">");
//Exception: Variable "data" does not exist
This script located in twig file cause:
Exception: Variable "data" does not exist
How to prepare append() content that contains twig and javascript variable?