# Thymeleaf Quick Guide * sample.java ```java @Controller public class JavascriptController { @RequestMapping("/") public String greeting(Model model) { int someReferenceId = 1234; //Deliver Results Array to the DOM model.addAttribute("referenceId", someReferenceId); return "index"; } } ``` * index.html * use thymeleaf syntax `/*[[${...}]]*/`to access the model data * [**JavaScript natural templating**! ](https://attacomsian.com/blog/thymeleaf-set-javascript-variable) ```html ``` * index.js ```js // within js file, can access 'referenceId' dclared in inline script under html function doSomething() { $.ajax({ type: 'GET', url: '/api/' + referenceId , contentType: 'application/json', beforeSend: beforeSend }) } ``` * alternative method using `` tag ```html ``` * external javascript file ```js function myFunction(){ var val = $("#yourId").val(); } ```