« Return to Thread: Velocity Variables are accepted in JavaScript Array??

Re: Velocity Variables are accepted in JavaScript Array??

by Int64 :: Rate this Message:

Reply to Author | View in Thread

Your suggestion for suggestions.push("$show"); really worked,

But can you please explain why suggestions.push($show);was not working and it was not working with my values from database(it was working for hard-coded values). and why your suggestion worked??
bluejoe-2 wrote:
if $show is a string, you can try
suggestions.push("$show");

VTL renders on server-side
while javascript executes on browser

yours,
bluejoe
 
----- Original Message -----
From: "Int64" <vineetbindal@gmail.com>
To: <user@velocity.apache.org>
Sent: Wednesday, June 10, 2009 2:05 PM
Subject: Velocity Variables are accepted in JavaScript Array??


>
> I am developing an Ajax AutoComplete using javascript.
>
> I have an Array in which i am adding elements.
>
> var suggestions = new Array();
>
> #foreach($show in $allShowList)
>
> suggestions.push($show);
>
> #end
>
> when i do the above it does not add the variables to the list(it doesnt
> display then in autosuggest)
>
> but if i do
> $show="someValue"
> suggestions.push($show);
>
> Then it adds this thing
>
> Can some1 tell me why, is it a type compatibility issue?
> --
> View this message in context: http://www.nabble.com/Velocity-Variables-are-accepted-in-JavaScript-Array---tp23956244p23956244.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4101 (20090525) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

 « Return to Thread: Velocity Variables are accepted in JavaScript Array??