Thanks very much to all for your suggestions. I will have to try these different ways as they are not immediately obvious to me (I am new to many of these technologies).
Thanks again. On Wed, Aug 1, 2012 at 2:42 PM, Niphlod <[email protected]> wrote: > I usually do the following: > > controller.py > > def function(): > .... > .... > jhelper = dict(myvar='1', myothervar='2') > return dict(whatever=whatever, jhelper=XML(json(jhelper))) > > > > in view controller/myfunction.html > > ..... > <script type="text/javascript"> > <!-- > jhelper = {{=jhelper}}; > console.log(jhelper.myvar) > // --> > </script> > > So I can use inside the javascript code the object containing all the vars > > > On Wednesday, August 1, 2012 8:31:59 PM UTC+2, Vincenzo Ampolo wrote: >> >> On 07/30/2012 10:55 AM, Curiouslearn wrote: >> > The above does not work. Is there a way that above can be made to >> > work? If so, can above work for cases in which the javascript variable >> > is an array or a json object. >> >> Make an ajax call using $.getScript() encoding the variables you want in >> the request as args or vars like >> >> $.getScript({{=URL('gen_javascript')}}/my_js_variable1/my_js_variable2) >> >> your server side gen_javascript function will generate the correct >> javascript and $.getScript() will run it. >> >> -- >> Vincenzo Ampolo >> http://vincenzo-ampolo.net >> http://goshawknest.wordpress.com > > -- > > > --

