Fw: [問題] onsubmit無效

看板Ajax作者 (奸商)時間13年前 (2012/08/25 16:40), 編輯推噓1(106)
留言7則, 3人參與, 最新討論串1/1
※ [本文轉錄自 Web_Design 看板 #1GE8z-Lz ] 作者: herman602 (奸商) 看板: Web_Design 標題: [問題] onsubmit無效 時間: Sat Aug 25 16:40:26 2012 以下是我的程式碼 主要問題是rsp.success返回true的時候 表單還是無法submit出去.... 有誰知道原因嗎.... 謝謝! <script type="text/javascript"> var ajaxCheck = function(customForm) { // fetch the data for the form var data = $(customForm).serializeArray(); // setup the ajax request $.ajax({ type: "POST", dataType: 'json', url: "check.php", data: data, cache: false, success: function(rsp){ if (rsp.success == true) return true; else return false; } }); return true; } </script> <form method="post" id="customForm" name="customForm" action="submit.php" onsubmit="return ajaxCheck(this);"> ...(略) <input type="submit" id="send" name="send" value="送出" /> </form> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.68.58.22 ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: herman602 (219.68.58.22), 時間: 08/25/2012 16:40:44

08/25 17:33, , 1F
在IE上的話,可能是因語法有錯而導致整段程式不能用
08/25 17:33, 1F

08/25 17:43, , 2F
我是用FF 14 ...@@
08/25 17:43, 2F

08/25 18:20, , 3F
既然都用jq了 直接用jq綁event看看吧
08/25 18:20, 3F

08/25 18:42, , 4F
我解決了....我validation的JS, 也在submit之前檢查
08/25 18:42, 4F

08/25 18:42, , 5F
結果那段js, 有些情況不會return true ...
08/25 18:42, 5F

08/25 18:43, , 6F
(沒貼在這的部分出錯) 我耍笨了 0rz 謝謝以上幾位
08/25 18:43, 6F

08/25 18:43, , 7F
跟丟我水球的人XD
08/25 18:43, 7F
文章代碼(AID): #1GE8-E5P (Ajax)
文章代碼(AID): #1GE8-E5P (Ajax)