That would be one way. On Jun 24, 9:05 am, Tom Ptacnik <to...@tomor.cz> wrote: > So if I need to get some variables in javascript from the app, you > advice is to generate it into the DOM? > > Example: I need to detect which culture is set. Then i should generate > <div id="culture" style="display:none;">en</div> into the DOM and then > in the javascript read the value of the div by id? > > On 23 čvn, 14:57, Massimiliano Arione <garak...@gmail.com> wrote: > > > On 22 Giu, 10:03, François <franc...@robichet.com> wrote: > > > > I'd like to pass values to my JS script when I call it. So I look the > > > API for the addJavascript() method, herre is it : > > > You shouldn't pass variables from php to javascript. > > Javascript should be always unobtrusive, so the only point of contact > > between your html (and php) and your javascript should be the DOM. > > Just insert your php variables somewhere in your page (e.g. in a > > hidden field of a form), then retrieve them with javascript (with > > jQuery, it's really simple) > > > cheers > > Massimiliano
-- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en