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});
        }
    });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM