0
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title\>Diktāta rezultāti\</title\>
<script type="text/javascript" th:src="@{/js/src/visualizer.bundle.js}"\>\</script\>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/\>

</head\>
 <body\>
    <div id='container'\>\</div\>
    <button th:onclick="visualizer.renderCorrect('container', \[\[${obj}\]\])"\>test\</button\>
 </body\>
</html\>

This is how my html template looks like. There is a button that calls function visualizer.renderCorrect(). This function accepts two parameters, one of them should be the id (in this case 'container') of the div container above and the other one should be String that comes from RequestController.

I tried multiple variations of function syntax, but every time i get this error - Uncaught TypeError: t is undefined. I guess there is a problem with passing arguments, since the function refuses to see passed parameters.html I attached a picture that shows how it looks like after clicking the button. I expect this function not to throw an exception.

Please, if someone knows, help to find the solution Thank you!

ArtjomM
  • 1
  • 2
  • Does this answer your question? [Setting up a JavaScript variable from Spring model by using Thymeleaf](https://stackoverflow.com/questions/25687816/setting-up-a-javascript-variable-from-spring-model-by-using-thymeleaf) – Alex R Jan 31 '23 at 22:12

0 Answers0