小编fre*_*shp的帖子

Json使用extbase在flow-templates中使用javascript

我试图在javascript变量中获取json.我在我的extbase typo3-extension中使用了fluid-templates.在我的动作中,我加载了一些卷曲的json.这个json我分配给模板.在我的模板中,它看起来像:

<script type="text/javascript">
var json = {jsonVarFromControllerAction};
</script>
Run Code Online (Sandbox Code Playgroud)

在这种情况下,json被解释为html代码.看起来像:

{&quot;content&quot;:&quot;testcontent&quot;}
Run Code Online (Sandbox Code Playgroud)

在控制器动作中它是一个正确的json!

{"content": "testcontent"}
Run Code Online (Sandbox Code Playgroud)

什么是解决方案?

javascript json typo3 fluid extbase

2
推荐指数
1
解决办法
3365
查看次数

标签 统计

extbase ×1

fluid ×1

javascript ×1

json ×1

typo3 ×1