I have below line in my grails gsp file.
<div class="pagination">
<g:paginate total="${lotCount ?: 0}" />
</div>
I want to pass lotCount value to one of my javascript named area-switcher.js file to further use it. How can I do this?
I tried to refer one suggestion from How to pass a value directly from a controller to a javascript file in Grails where I do below in my gsp
<g:javascript> var theId = ${lotCount} </g:javascript>
and try below in my js file for testing
alert(theId);
but it doesn't work. Got error like ReferenceError: theId is not defined. Please help.
var theId = "${lotCount}";