简体   繁体   English

从树枝 symfony2 视图向 js 发送 xml

[英]Send an xml to js from a twig symfony2 view

I've trouble to send an xml to JS.我很难将 xml 发送到 JS。 When I try to, the JS just doens't answer.当我尝试时,JS 只是不回答。 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.但我正在使用原始数据,所以它不应该...... xml 来自数据库,但为了研究,我会把它给你。

WARNING: it's only the begining of the file (4k chars)警告:这只是文件的开头(4k 个字符)

<?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".过滤器有一个别名“e”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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