Reputation: 589
I am trying to pass a Javascript var = value
that I receive from an Ajax response to the twig |trans
filter so I can translate the strings.
{{('makler.realestate::lang.tip_neprem.' ~ value)|trans}}
doesn't work, because value returns empty.
$.each( tipi_nepremicnin, function( key, value ) {
$(select_input)
.append(
"<option value='" + value + "'>"
+ '{{('makler.realestate::lang.tip_neprem.' ~ value)|trans}}'
+ "</option>").removeAttr("disabled"
);
}
Upvotes: 1
Views: 470
Reputation: 1209
You can't do that.
You've got two solutions :
Upvotes: 1