I'm trying to create a Thymeleaf link which will redirect to another site with 2 accordeon bodies already open.
On page 'exercises' I've got collapsible items that appear when I call them by passing value in URL, like:
/exercise#Category
I've done that by using following JS script:
$(document).ready(function () {
if(location.hash != null && location.hash != ""){
$(location.hash).collapse('show');
}
});
The questions are:
To create link i've tried following, but it doesn't work.
th:onclick="'window.location.href = \'' + @{/exercises#${exercise.getCategory()}} + '\''">
Which resulted in not converting variable to String, so i've got in browser:
/exercises#${exercise.getCategory()}