python 2.7 django 1.11 jquery 2.11
这是为何的? 不是停留在原始页面
而且 ajax 中的alert
也没有弹窗。
![]() | 1 RudyC 2017-11-16 15:02:44 +08:00 type=submit |
![]() | 3 manzhiyong 2017-11-16 17:08:39 +08:00 .onclick(function(ev) { 加个参数 ev,下面再加一行: ev.preventDefault(); |
![]() | 4 fanne OP @manzhiyong #3 这个事件添加后,也没啥效果 |
5 Kokororin 2017-11-16 17:52:36 +08:00 jQuery 有 onclick ?? |
![]() | 6 awanabe 2017-11-16 17:53:35 +08:00 type=submit 的 按钮会触发 提交时间.. 而你是想要异步提交, 和 form 本身的提交冲突的. # 1. 先禁掉自动提交 $('#jsStayForm').submit(function(){ return false; }) # 2. 把 button 的 type=submit 去掉 # 3. jquery 里面 是 .click(), 不是 onclick |
8 Dganzh 2017-11-17 09:21:48 +08:00 因为返回的都是成功的状态啊,都是 200,你应该在失败的响应中加 400: HttpResponse(....., status_code=400, content_type=.....) |