opensubscriber
   Find in this group all groups
 
Unknown more information…

p : python-list@python.org 27 October 2011 • 11:55AM -0400

Re: passing Python data to a javascript function
by Chris Angelico

REPLY TO AUTHOR
 
REPLY TO GROUP




On Thu, Oct 27, 2011 at 2:51 PM, Bill Allen <wallenpb@gmai...> 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.
>
> --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
--
http://mail.python.org/mailman/listinfo/python-list

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.