[prev in list] [next in list] [prev in thread] [next in thread]
List: velocity-user
Subject: Re: velocity -> JavaScript (Array)
From: Claude Brisson <claude () renegat ! net>
Date: 2011-06-29 13:26:59
Message-ID: 4E0B2823.50301 () renegat ! net
[Download RAW message or body]
With something like this :
<script type="text/javascript">
var tmp = [
#foreach( $i in $myArray )#if($foreach.index> 0),#end $i #end
];
</script>
if $i contains strings, you can print '$i' quoted
Claude
On 2011-06-29 10:07, LaStudent wrote:
> Hello,
>
> how can I pass an array of Strings from velocity to JavaScript?
>
> I can do it with Integer such as:
> -----------------------------------------------------------------------
> {{velocity}}
>
> #set($myArray = [...])
>
> {{/velocity}}
>
> <script type="text/javascript">
>
> var tmp = ${myArray};
> ...
>
> </script>
> -----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic