In python CGI, how to pass "hello" back to a javascript function as an argument at client side?

Piet van Oostrum piet at cs.uu.nl
Tue Oct 13 05:05:23 EDT 2009


>>>>> zxo102 <zxo102 at gmail.com> (z) wrote:

>z> Hi everyone,
>z>     How can I pass a string generated from python cgi at server side
>z> to a
>z> javascript function as an argument at client side?

>z>  I want test.py to "return"  a "hello" back so the javascript function
>z> load takes "hello" as argument like  load("hello").

>z> 2. server side: test.py
>z> ...
>z> #!c:\python24\python.exe

>z> def main():
>z>    message = 'hello'
>z>    #return message

>z> main()
>z> ...

>z> Any ideas?

CGI scripts return stuff by printing it, or more generally writing to
stdout.

So print message should do. The rest is not a Python question but a
Javascript question.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list