ajaxSubmit的使用

来源:互联网 发布:mac 虚拟机 win10 好吗 编辑:程序博客网 时间:2024/06/06 11:02

所需要的js:

  jquery.min.js;

  jquery.form.js。

html:

<form>
    <input type="text" name="title" />
    <button>提交</button>
</form>

jq:

$('button').click(function () {


        var title = $('inpur[name=title]').val(),
            content = $('textarea').val();

       /* $(this).ajaxSubmit({
            type: 'post', // 提交方式 get/post
            url:url, // 需要提交的 url
            data: {
                'title': title,
                'content': content
            },

            success: function(data) { // data 保存提交后返回的数据,一般为 json 数据
                alert('提交成功!');
            }
    });*/

         ajaxSubmit("url", {
                'title': title,
                'content': content       
                }, function(returnData) {
                    if ("success" == returnData.status) {
          
                    } else {
                    
                    }
                });
});