简体   繁体   English

Thymeleaf:解析Javascript表达式时出错

[英]Thymeleaf: Error parsing a Javascript expression

I have a Thymeleaf template with this piece of code 我有一块Thymeleaf模板,上面有这段代码

<a href="#" th:onclick="'performAjaxCall('@{/mymenupricesummary/pricealarm/1/{id}(id=${menuPriceSummary.menu.id})}');'">

But when I start the app I got this error: 但是,当我启动应用程序时,出现此错误:

Could not parse as expression: "javascript: ...

Yes, you need to format this correctly. 是的,您需要正确设置其格式。 This works for me: 这对我有用:

<a href="#" th:onclick="'performAjaxCall(\'' + @{/mymenupricesummary/pricealarm/1/{id}(id=${menuPriceSummary.menu.id})} + '\');'">

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

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