I render some data with Twig and do somethink like this:
var products = {
{% for item in items %}
{{ item.id }} : {
'title': '{{ item.title }}',
'info': '{{ item.info }}',
}
}
There is an error, caused by line breaks in item.info variable.
I tried some tricks: replace \n\r to <br /> etc.
What should I do?
UPD #1
Error message: Uncaught SyntaxError: Unexpected token ILLEGAL
UPD #2
The replacement of \n and \r does without problems. The problem is that I need variable to be with line-breaks, not in one line.
Try end each line with a backslash i.e \
For example