Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15021 > unrolled thread

Re: passing Python data to a javascript function

Started byChris Angelico <rosuav@gmail.com>
First post2011-10-27 14:55 +1100
Last post2011-10-27 14:55 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: passing Python data to a javascript function Chris Angelico <rosuav@gmail.com> - 2011-10-27 14:55 +1100

#15021 — Re: passing Python data to a javascript function

FromChris Angelico <rosuav@gmail.com>
Date2011-10-27 14:55 +1100
SubjectRe: passing Python data to a javascript function
Message-ID<mailman.2247.1319687731.27778.python-list@python.org>
On Thu, Oct 27, 2011 at 2:51 PM, Bill Allen <wallenpb@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.
>
> --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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web