ajax带对象提交

//卖船要求信息

            var sellerVesselInfo = {

"vesselName": vesselName,

"registry": registry,

"vesselTexture": vesselTexture,

"jobType": jobType,

"grossTon": grossTon,

"netTon": netTon,

"loa": loa,

"beam": beam,

"vesselDepth": vesselDepth,

"enginType": enginType,

"engine": engine,

"yard": yard,

"vesselExplain": vesselExplain,

"stringBuilt":$("#built1").val(),

"projectCode": projectCode

};

//卖家信息

            var sellerInfo = {

"owner": owner,

"ownerCode": ownerCode,

"address": address,

"ownerTel": ownerTel,

"saleRequirement": saleRequirement,

"vesselOwnerType":"true",

"projectCode": projectCode

};

//船舶所有人所占比例

//            var sellerStockPercent = {

//                "owner": $("#people").val(),

//                "pencent": $("#percent").val(),

//                "projectCode": $("#project_code").html()

//            };

            var para = {

"id": $("#ID").html(),

"projectCode": projectCode,

"projectName": projectName,

"assessmentPrice": assessmentPrice,

"listingPrice": listingPrice,

"stringListingStart":$("#listing_start_date").val(),

"stringListingEnd":$("#listing_end_date").val(),

"contactsPerson": contactsPerson,

"contactsOfficeTel": contactsOfficeTel,

"contactsTel": contactsTel,

"contactsFax": contactsFax,

"status":status,

"sellerVesselInfo": sellerVesselInfo,

"sellerInfo": sellerInfo,

"sellerStockPercent": getValue()

};

console.info(JSON.stringify(para));

$.ajax({

type:"POST",

url:"/saleApplication/saveApplication",

contentType:'application/json;charset=UTF-8',

data: JSON.stringify(para),

dataType:"json",

success:function (data) {

console.log(data);

console.log(data.success);

if (data.success) {

//设置保存按钮有效

                        $("#save").attr("disabled",false);

sweetAlert('操作成功');

window.location.href ='/saleApplication';

}else {

//设置保存按钮有效

                        $("#save").attr("disabled",false);

sweetAlert('未知错误');

//window.location.href = '/saleApplication';

                    }

}

});

}

你可能感兴趣的:(ajax带对象提交)