P
PJ
Hi,
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.
The post function is
def do_POST(self):
global rootnode
try:
ctype, pdict = cgi.parse_header(self.headers.getheader
('content-type'))
if ctype == 'multipart/form-data':
query=cgi.parse_multipart(self.rfile, pdict)
self.send_response(301)
self.end_headers()
print(query.get('data'))
print('test')
h = codecs.open ("log.txt", "a", encoding="utf8")
h.write("test")
h.close()
except :
pass
The AJAX post is appearing in the command prompt as any other post and
I can't see any reason why it shouldn't go to this function,
particularly if it works for a regular (non-AJAX) post, so any help
would be appreciated,
Paul
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.
The post function is
def do_POST(self):
global rootnode
try:
ctype, pdict = cgi.parse_header(self.headers.getheader
('content-type'))
if ctype == 'multipart/form-data':
query=cgi.parse_multipart(self.rfile, pdict)
self.send_response(301)
self.end_headers()
print(query.get('data'))
print('test')
h = codecs.open ("log.txt", "a", encoding="utf8")
h.write("test")
h.close()
except :
pass
The AJAX post is appearing in the command prompt as any other post and
I can't see any reason why it shouldn't go to this function,
particularly if it works for a regular (non-AJAX) post, so any help
would be appreciated,
Paul