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

zxo102 zxo102 at gmail.com
Mon Oct 12 19:31:46 EDT 2009


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

Here is my case:

1. client side:
     "load" is a javascript function in a html page. It starts the
python CGI "test.py" via Apache:
<html>
<script language="javascript">
...
    load("test.py" );
...
</script>
...
</html>

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

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

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

main()
...

Any ideas?


Thanks in advance for your help.


ouyang




More information about the Python-list mailing list