jQuery异步提交form表单
2015-03-27 10:18
309 查看
使用jquery.form.js官网现在地址表单插件来实现异步form表单提交。
先看看官方的介绍:
实际使用中的方式:
先看看官方的介绍:
/* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are mutually exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').on('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); You can also use ajaxForm with delegation (requires jQuery v1.7+), so the form does not have to exist when you invoke ajaxForm: $('#myForm').ajaxForm({ delegation: true, target: '#output' }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */
实际使用中的方式:
<script type="text/javascript"> $(document).ready(function () { $("#btnAjaxSubmit").click(function () { var options = { url: 'action.url', type: 'post', dataType: 'text', data: $("#form").serialize(), //序列化 success: function (data) { //提交成功之后的回调函数 if (data.length > 0){ $("#responseText").text(data); } } }; // ajaxForm $("#form").ajaxForm(options); // ajaxSubmit $("#form").ajaxSubmit(options); }); }); </script>
相关文章推荐
- $.ajax 和 jquery.form.js实现表单异步提交
- 使用jQuery.form插件,实现完美的表单异步提交
- jQuery异步提交form表单
- Jquery.Form 异步提交表单实例
- jquery表单插件 jquery.form(异步提交)(学习总结)
- 异步提交form的时候利用jQuery validate实现表单验证
- Jquery.Form 异步提交表单实例
- 异步提交form的时候利用jQuery validate实现表单验证
- 如何在异步提交form的时候利用jQuery validate实现表单验证
- Jquery 异步提交表单有form无form的时候处理方式
- 使用jquery插件jquery.form.js,异步提交表单 1
- JQuery异步提交表单(不使用jQuery.form插件)
- 使用jQuery.form插件,实现完美的表单异步提交
- 使用jQuery.form插件,实现完美的表单异步提交
- 使用jQuery.form插件,实现完美的表单异步提交
- 使用jquery插件jquery.form.js,异步提交表单 1
- jQuery异步提交form表单
- 使用jQuery.form插件,实现完美的表单异步提交
- 使用jQuery.form插件,实现完美的表单异步提交
- 使用jQuery.form插件,实现完美的表单异步提交【转发】