0

I have a Thymeleaf template with this piece of code

<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: ...
en Peris
  • 1,537
  • 12
  • 31
  • 63
  • Possible duplicate of [Javascript function call with Thymeleaf](https://stackoverflow.com/questions/26526037/javascript-function-call-with-thymeleaf) – Nick Apr 19 '18 at 11:20

1 Answers1

2

Yes, you need to format this correctly. This works for me:

<a href="#" th:onclick="'performAjaxCall(\'' + @{/mymenupricesummary/pricealarm/1/{id}(id=${menuPriceSummary.menu.id})} + '\');'">
Metroids
  • 18,999
  • 4
  • 41
  • 52