关于这个主题已经讨论了很多,我的问题的特点仍然是我使用beforeSend
,并且我将错误归咎于我可能错误地使用此运算符。< / p>
所以我有这个JS代码:
DATA_LIST_REQUEST = $.ajax(
{
type:'GET',
url:"/ajax_refresh_order_suggestions/",
beforeSend : function()
{
if(DATA_LIST_REQUEST != null)
DATA_LIST_REQUEST.abort();
},
data:data,
success: function(response)
{
refresh_zeon_data_table(response, $table);
}
});
各自的Django视图在其代码中没有任何特殊之处,所以我不发布它以使问题简明扼要(将根据要求提供)。
每次用户更改组合框时都会调用上面的代码。有时 - 不总是 - 我得到这个令人不快的error: [Errno 10053] An established connection was aborted by the software in your host machine
错误,其中最有趣的是不会导致致命的错误行为,我仍然会收到答案,但它需要8或9秒而不是其他即时响应。
我在上面提到的JS代码中做错了吗?
这里是完整的追溯
Exception happened during processing of request from ('127.0.0.1', 61839)
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 99, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python27\lib\SocketServer.py", line 657, in __init__
self.finish()
File "C:\Python27\lib\SocketServer.py", line 716, in finish
self.wfile.close()
File "C:\Python27\lib\socket.py", line 283, in close
self.flush()
File "C:\Python27\lib\socket.py", line 307, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in your host machine
----------------------------------------
[31/Oct/2016 01:27:29] "GET /ajax_refresh_order_suggestions/?q=&legal_entity_own_id=5398&vendors=%5B%5D&merchandise=%5B%5D&positive_chosen_quantity_filter=true&zero_chosen_quantity_filter=true&suggested_equal_to_chosen=true&suggested_less_than_chosen=true&suggested_greater_than_chosen=true HTTP/1.1" 200 46