简体   繁体   中英

Send an xml to js from a twig symfony2 view

I've trouble to send an xml to JS. When I try to, the JS just doens't answer. There is a weird error which seems to be because the variable is executed. But I'm accually using raw so it should not... The xml is from a database but for the research I'll give it to you.

WARNING: it's only the begining of the file (4k chars)

<?xml version='1.0' encoding='UTF-8'?>

I hope you'll get some ideas! :)

<td onclick="showMap('{{ parcours.kml|raw }}')">test</td>

Thank you!

The use of the filter escape works.

<td onclick='showMap("{{ parcours.kml|escape }}")'>test</td>

The filter has an alias "e".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM