passing Python data to a javascript function

engg at cleantechsolution.in engg at cleantechsolution.in
Fri Aug 9 04:36:09 EDT 2013


On Thursday, October 27, 2011 9:25:28 AM UTC+5:30, Chris Angelico wrote:
> On Thu, Oct 27, 2011 at 2:51 PM, Bill Allen <wallenpb at gmail.com> wrote:
> 
> > Chris,
> 
> >
> 
> > Wow, that seems so simple now that I see it.  I was dancing around that all
> 
> > day, but just not landing on it.   Thanks so very much for the assist.
> 
> >This code is giving an error 500 when run. Although the python code is independently running OK

> 
> > --Bill
> 
> >
> 
> > Final code that works perfectly, passes the value from the Python script to
> 
> > the javascript correctly:
> 
> >
> 
> > <body onload="showPID("""+pid_data+""")">
> 
> 
> 
> Congratulations! You've just written code that writes code. It takes a
> 
> bit to get your head around it (especially when you start worrying
> 
> about literal strings that might contain quotes, for instance), but
> 
> it's really cool and seriously powerful stuff. Your server-side Python
> 
> code can generate client-side Javascript code any way it likes...
> 
> unlimited possibilities.
> 
> 
> 
> ChrisA




More information about the Python-list mailing list