我有一段带有这段代码的Thymeleaf模板
<a href="#" th:onclick="'performAjaxCall('@{/mymenupricesummary/pricealarm/1/{id}(id=${menuPriceSummary.menu.id})}');'">
但是当我启动应用程序时,我收到了这个错误:
Could not parse as expression: "javascript: ...
答案 0 :(得分:2)
是的,您需要正确格式化。这对我有用:
<a href="#" th:onclick="'performAjaxCall(\'' + @{/mymenupricesummary/pricealarm/1/{id}(id=${menuPriceSummary.menu.id})} + '\');'">