1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > $.ajaxSubmit form表单ajax提交

$.ajaxSubmit form表单ajax提交

时间:2023-07-17 20:39:07

相关推荐

$.ajaxSubmit  form表单ajax提交

Form表单ajax提交

<style>#agreementSub{margin-top: 20px;display: block;width: 100px;height: 40px;text-align: center;border-radius: 10px;line-height: 40px;background: cornflowerblue;color: #ffffff;cursor: pointer;}</style><script src="/jquery-1.8.3.min.js"></script><script src="http://malsup.github.io/jquery.form.js"></script><form id="mainForm" method="post" enctype="multipart/form-data" class="jsrz_main_information">姓名:<input type="text" name="UserName" value="" /><br>年龄:<input type="text" name="UserAge" value="" /><br>地址:<input type="text" name="UserAddr" value="" /><br>邮箱:<input type="text" name="UserEmail" value="" /><br><div class="jsrz_main_button"><a value="提交" id="agreementSub">tijiao</a></div></form><script>$("#agreementSub").on("click",function(){$('#mainForm').ajaxSubmit(//ajax方式提交表单{url: 'http://192.168.199.218/boao/public/index.php/api/index/index',type: 'post',dataType: 'json',beforeSubmit: function () {},success: function (data) {console.log(data);},clearForm: false,//禁止清楚表单resetForm: false //禁止重置表单});});</script>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。