1 <form id="luckDrawAdd" method="post" enctype="multipart/form-data">
2 <table class="searTabBg" width="100%">
3 <tr>
4 <td style="padding-left: 112px">
5 <button id="confirmSubmit" type="button">
6 <span><span>确认提交</span></span>
7 </button>
8 </td>
9 </tr>
10 </table>
11 </form>
12 <script language="JavaScript" type="text/javascript">
13 var ctx = '${ctx}';
14 $(document).ready(function () {
15 //表单是否已经提交
16 var isCommitted=false;
17
18 $("#confirmSubmit").click(function () {
19
20 /*防止表单重复提交*/
21 if(isCommitted==false){
22 isCommitted=true;
23 }else{
24 alert("请不要重复提交表单!");
25 return;
26 }
27 var formData = new FormData($("#luckDrawAdd")[0]);
28 $.ajax({
29 type: "post",
30 url: '',
31 data: formData,
32 contentType: false,
33 processData: false,
34 success: function (data) {
35 console.log(data);
36 if ('0000' == data.responseCode) {
37 alert("添加成功!");
38 window.location.href = '';
39 }
40 },
41 error: function () {
42 alert("系统异常,添加失败!");
43 /*将表单提交标志改为false*/
44 isCommitted=false;
45 }
46 });
47 });
48 });
49
50 </script>