Admittedly I'm not too familiar with Smarty, however, if this is purely a server-side templating engine (which I thought it was) then you can't "set a Smarty variable inside JavaScript" (which runs only on the client).
You can set a JavaScript variable inside Smarty (or rather, you can construct the JS that will ultimately run on the client inside Smarty), but not the other way round.
What is it you are trying to achieve?
toplisek
11:14 am on Apr 17, 2015 (gmt 0)
It is actually not correct. If you try to put session variable inside Javascript you have to break Javacript using {literal} and finish {/literal}
So, when this breaks you can add Smarty variable. There is an issue that variable is not detected such as {$myvariable.name1}. It will be doubled.
Ahhh... ok... so, JavaScript doesn't really have anything to do with it?! You are trying to output (not set?) a Smarty variable inside a Smarty {literal}, but the double brace is an issue (yes, you did mention this, but it wasn't clear from your example)...
What about if you separate the braces with some whitespace? (no pun intended) For example: