jQuery.fn.ajaxSubmit

来源:互联网 发布:手机量角器软件 编辑:程序博客网 时间:2024/05/29 16:53

系列文章:http://doc.cmstop.com/develop/214.html

使用ajax方式提交form表单。

§   原型:

<jQuery> $(form).ajaxSubmit({

            url : '<string>', // 提交目标默认取自formaction
            type : 'POST|GET', // 
提交方式 默认取自form 或者GET
            data : <hash>, // 
额外需要提交的数据
            // 
序列化表单数据之前回调函数可以尝试修改表单内容
            beforeSerialize : function(form, options){},
            // 
数据准备好了准备提交这时候做些事情比较修改下序列化后数据
            beforeSubmit: function(elements, form, options){}
            // ... 
其它$.ajax所支持的配置

});

$(form).ajaxSubmit({            dataType:'json',            type:'POST',            success:function(json){            console.info(json);},error:function(){alert('请求异常')},complete:function(){            buttons.attr('disabled', false);},beforeSubmit:function(){            buttons.attr('disabled', true);},beforeSerialize:function(form, options){            form[0].someinput.value = 'changed value';}});


原创粉丝点击