有人可以帮我确定以下请求有什么问题。即使在服务器端我只是返回一个空页面,我也会不断收到软件中止!那就是我什至没有阅读后请求的内容。当我使用表单发布方法而不是 ajax 发送 HTTP 发布请求时,一切都很好。所以我相信没有服务器问题。
谢谢!!
$.ajax({
type: 'post',
url: "/ajax/feedback",
data: JSON.stringify(["Add","1","2"]),
contentType: 'application/json',
dataType: 'json',
success: function(resp){
alert("Success. Server said:\n '" + resp + "'");
},
error: function(e){
alert('There is an Error: ' + e);
}
});
在服务器端(python-GAE),我所做的一切如下:
def post(self):
logging.info('in post REQUEST request handler')
self.response.headers['Content-Type'] = 'text/html'
self.response.out.write("received!")
我得到的错误如下:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python25\Lib\SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
File "C:\Program Files (x86)\Python25\Lib\SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
File "C:\Program Files (x86)\Python25\Lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2780, in __init__
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "C:\Program Files (x86)\Python25\Lib\SocketServer.py", line 521, in __init__
self.handle()
File "C:\Program Files (x86)\Python25\Lib\BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Program Files (x86)\Python25\Lib\BaseHTTPServer.py", line 310, in handle_one_request
method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2794, in do_POST
self._HandleRequest()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3090, in _HandleRequest
raise e
error: (10053, 'Software caused connection abort')