javascript序列化表单追加参数

js序列化表单后追加参数方式:

追加参数:token,status    
var data = $.param({"token":token, "status":status}) + "&" + $("#form").serialize();
    $.ajax({
        url:"newsController/save",
        dataType:"json",
        async:true,
        data: data,
        type:"post",
        beforeSend:function(){
            //请求前的处理
        },
        success:function(req){
            if(req.code == 200) {
                layer.msg(req.msg, {
                    icon: 6,
                    time: 1000
                }, function(){
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.window.document.location.reload(); 
                    // parent.$('.btn-refresh').click();
                    parent.layer.close(index);
                });  
            } else {
                layer.msg(req.msg,{icon:5,time:1000});
            }
        },
        error:function(xhr){
            layer.msg('error!',{icon:1,time:1000});
        }
    });

 

posted @ 2017-11-07 10:26  飘絮不飘  阅读(2552)  评论(0编辑  收藏  举报