en Peris
en Peris

Reputation: 1717

Thymeleaf: Error parsing a Javascript expression

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: ...

Upvotes: 0

Views: 484

Answers (1)

Metroids
Metroids

Reputation: 20477

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

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

Upvotes: 2

Related Questions