You can extract values like this:
var lessonId = [[${lesson.id}]];
var questionId = [[${question.id}]];
but I am not sure that it is a way to go. If you are working with the lists, you would need to extract them in js which means twice the work on the machine side...
There is a way to do it, but probably little different than what you thought!
An example of how I managed my popup box to confirm removal of item from the list:
<script th:inline="javascript">
function deleteObject(id) {
bootbox.confirm([[#{msg.ask}]], function(result) {
if (result) {
var url = /*[[ @{'/admin/vozila/izbrisi?vin='} ]]*/ "genericUrl";
url = url+id;
document.location = url;
}
});
};
</script>
Once this is done, all you need is to call it and pass the object id:
<a class="btn btn-default btn-sm" href="#" th:onclick="'javascript:deleteObject(\'' + ${vozilo.vin} + '\');'"><i class="glyphicon glyphicon-remove"></i><span th:text="#{rad.obr}">Radnja - izbrisi</span></a>
So you are not getting thymeleaf rendered inside js, but you pass the values to the function when called.
I guess in your case it would look something like this:
<script th:inline="javascript">
function callLink(lessonID, questionID){
var fieldPathStr = lessonID+/*[[@{'/questions/'}]]*/"1/questions/2";
var finalStr = lessonID+fieldPathStr+questionID;
};
</script>
where questionID, and lessonID should look like this:
<a href="#" th:onclick="'javascript:callLink(\'' + ${lesson.id} + '\', \'' + ${question.id} + '\');'"></a>
Hope this works for you?