AJAX Post requests

Tim Roberts timr at probo.com
Tue Feb 10 02:37:12 EST 2009

PJ <pauljefferson at gmail.com> wrote:
>I have a simple web server using  BaseHTTPServer, and the def do_POST
>(self) function works fine for regular forms that are submitted to it,
>but when I send an AJAX POST to it it does nothing (I've tried to just
>get it to print to check it's nothing else but it doesn't even do
>that, although it does for a regular POST request.

Are you absolutely sure your AJAX request is being sent with Content-Type
multipart/form-data?  Your code would explode silently if it didn't,
because "query" would not exist when you got to "print(query.get('data'))",
and your blanket "except" would hide the error.
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list