I am writting a application using jquery(ajax) and python. When I send the request using ajax to call a php script, everything works. But when I tried to call a python script, I got this error.
malformed header from script. Bad header=AAAAAA
I am not sure what I am missing. The only difference is the type of script ajax is calling.
Following is my php script called:
*<?php
echo "AAAAA"
?>*
Following is my python script called:
#!/usr/bin/env python
def main():
print "AAAAAA"
if __name__ == "__main__":
main()
=========================================== Any idea?
Thanks
PHP was designed for web programming so it automatically attaches Content-type
to HTTP headers but Python doesn't. Prepend this to main()
:
print "Content-Type: text/html\n"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With