<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script><script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<form method="post" class="form-horizontal" id="item4FormHandle" enctype="multipart/form-data">$().ready(function() { $("#item4FormHandle").validate({ submitHandler:function(form){ ajaxPutInto(); } }); });function ajaxPutInto(){ var formData = new FormData(document.getElementById("item4FormHandle"));//表单id $.ajax({ url: type: 'POST', data: formData, async: false, cache: false, contentType: false, processData: false, success: function (result) { console.log(result); alert("递交成功"); }}); };
<button id="putInto" class="btn btn-sm btn-info pull-right m-t-n-xs" type="submit"><strong>确 定 提 交</strong></button>
h5 form 带有文件的递交 自动验证 ajax
最新推荐文章于 2022-11-17 21:46:54 发布