Thymeleaf:解析Javascript表达式时出错

时间:2018-04-19 11:12:58

标签: javascript jquery html html5 thymeleaf

我有一段带有这段代码的Thymeleaf模板

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

但是当我启动应用程序时,我收到了这个错误:

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

1 个答案:

答案 0 :(得分:2)

是的,您需要正确格式化。这对我有用:

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