Grails (controllers, GSP and tags, etc.) work on the server side. JavaScript on the client side. And this link is prepared before sending data to the browser and before JavaScript can pass its variable to the GSP tag.
But you can prepare the base link on the server side and add an additional parameter on the client side using javascript, for example:
var search= document.getElementById('appMenu').value; document.location.href= '${createLink(controller: 'application' , action:'ajaxAppSearch')}?query=' + escape(search);
source share