Page 1 of 1

Passing javascript variable to velocity variable templete

Posted: Thu Oct 26, 2017 8:37 am
by charan-ram
Hi everyone,
Could anyone please tell me that how can I pass javascript varible to velocity templete. I have gone through few forums that I need to pass the parameter to server to get this but I have no idea. Please find the files below. Thank you.

Code: Select all

<script type="text/javascript">
function generateFunction()
{
  var variable = document.getElementById('text').value;
}
</script>

#set($test = "variable")
$test

Re: Passing javascript variable to velocity variable templete

Posted: Thu Nov 30, 2017 2:48 pm
by martins
I don't understand what's your intention. Maybe you can describe your usecase more in detail.

Javascript code is normaly executed on client side (in the user's web browser) but velocity code is already executed on server side before the webserver delivers the content to the browser.

Martin