Enterキーを押してフォームを送信すると問題が発生します。フォームの送信時にajaxでNoneTypeエラーが発生する
これは次のように私のJSコードがどのように見えるかです:私は送信ボタンを押すと、すべてが大丈夫作品
$.fn.api.settings.api = {
'password_reset': '/account/password_reset/'
}
$('.ui.form')
.form({
fields: {
email: 'empty'
}
})
.api({
action: 'password_reset',
method: 'post',
serializeForm: true,
onSuccess: function() {
$('.page.dimmer').dimmer('show');
console.log('success')
}
})
;
が、私は、コンソールで、ENTERを押してフォームを送信する場合、私は得る:
[18/Aug/2017 21:05:20] "POST /account/password_reset/ HTTP/1.1" 200 6
Traceback (most recent call last):
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\mihai\miniconda3\Lib\socket.py", line 593, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection has been dropped by the software on the host computer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\Mihai\Desktop\dev_place\env\lib\site-packages\django\core\servers\basehttp.py", lin
e 88, in handle_error
super(ServerHandler, self).handle_error()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\mihai\miniconda3\Lib\socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "c:\users\mihai\miniconda3\Lib\socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\users\mihai\miniconda3\Lib\socketserver.py", line 681, in __init__
self.handle()
File "C:\Users\Mihai\Desktop\dev_place\env\lib\site-packages\django\core\servers\basehttp.py", lin
e 155, in handle
handler.run(self.server.get_app())
File "c:\users\mihai\miniconda3\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\users\mihai\miniconda3\Lib\wsgiref\simple_server.py", line 36, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
はAttributeErrorは:「NoneType」オブジェクトには属性「スプリット」なぜ私はENTERを押して、このエラーを唯一取得しています
を持っていませんか?
また、コンソールで「成功」メッセージが表示されません。
は、私が使用します。 ジャンゴ11.1、 のjQuery 3.2.1、 jQueryのserializeObject 2.5.0(serializeForm用)2.2、-UI意味。 のWindows 8.1
編集:私はtrueにデバッグを設定し、私はいくつかのエラーを探すために始めた: XHR Aborted (Most likely caused by page navigation or CORS Policy)
私は、トレースバックの呼び出しでConnectionAbortedError: [WinError 10053] An established connection has been dropped by the software on the host computer
ことに気づきました。
私はまだそれを理解していません。
どうすればよいですか?
お返事ありがとうございます!