js 给serialize对象添加元素

 var longTermValue=$("#longTerm").val();
    var data = $.param({
        "longTerm" : longTermValue
    }) + "&" +$('#merchantForm').serialize();
    //下面使用data
        var action_url = '<@c.url value="/enterprise/corporation/update"/>';
        $.ajax({
                url:action_url,
                type:'post',
                dataType:'json',
                timeout:60000,
                async:false,
                data:data,
                success:function(data,textStatus,jqXHR){
                    if(data!=null && data.success){
                        <#if Corporation??>
                        window.location.href='<@c.url value="/enterprise/corporation/"/>' +  ${Corporation.merchantId};
                        </#if>
                    }else{
                        var msg = data.message;
                        POSS.showValid(msg);
                        //$this.removeAttr("disabled");
                        $('#myModal').modal('hide');
                    }
                },
                error:function(XMLHttpRequest,textStatus, errorThrown) {
                    POSS.showValid("系统烦忙,请稍后再试");
                    //$this.removeAttr("disabled");
                }
            });

你可能感兴趣的:(前端)