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


Groups > comp.lang.python > #15021

Re: passing Python data to a javascript function

References <CACrcdXvi6NDY5CM_AqH0BB6CVx8TRbTBjATu4kbYbcyBJfJNwQ@mail.gmail.com> <CAMuTYXhjuYuouX7+u5h1bE43x9ceWm9aUZ5CoDtu0c2Geuz8ZA@mail.gmail.com> <CACrcdXsXUkLWtkwYADMF-wMjsKjL7VCcSaKW-Y9D83_7Ox5-OQ@mail.gmail.com> <CAMZYqRSNmrazz1VM3VVq0b-KSVKN+JpVFix3fo8-iDaT6wLBvA@mail.gmail.com> <CACrcdXuoNuB_c_ewwanOXWXuMT8oEcb4KZiRe7Tgf0Ug81Pq6Q@mail.gmail.com>
Date 2011-10-27 14:55 +1100
Subject Re: passing Python data to a javascript function
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2247.1319687731.27778.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web