Re: Passing values from Django to client-side JavaScript

2007-01-21 Thread rzimerman
Jeremy Dunck wrote: > On 1/19/07, rzimerman <[EMAIL PROTECTED]> wrote: > > > > I'd like to pass variable values from Django to client-side JavaScript > > at page load time. Currently I've use Django's templating system to > > dynamically rewrite the JavaScript code, such that the appropriate > > v

Re: Passing values from Django to client-side JavaScript

2007-01-19 Thread Brian Beck
The JSON method mentioned above should work fine. Two methods that might be less fragile than code generation: - Hidden form inputs. Less fragile because the 'escape' filter should allow you to safely dump data into attribute values in your template, I think. Then use form.elements or MochiKit'

Re: Passing values from Django to client-side JavaScript

2007-01-19 Thread Jeremy Dunck
On 1/19/07, rzimerman <[EMAIL PROTECTED]> wrote: I'd like to pass variable values from Django to client-side JavaScript at page load time. Currently I've use Django's templating system to dynamically rewrite the JavaScript code, such that the appropriate values get set. But, is there a less hac

Re: Passing values from Django to client-side JavaScript

2007-01-19 Thread Jeremy Dunck
On 1/19/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: var foo = {{ data }}; alert(data['bouzouki']); Err, that should be: alert(foo['bouzouki']) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou