一、字符串
$.ajax({
type: "POST",
data: {"ID":id,"name":name},
url: "/XX/XXX/XXXX",
cache: false,
success: function (result) {
if (result > 0) {
alert("保存成功!");
}
else {
alert("保存失败,请稍后再试!");
}
}
});
后台 XXXX(string ID,string name){} //ID、name
二、实体类
var data = {};
data["ydayScheduleCount"] = $("#ydayScheduleCount").val();
data["ydayRealCount"] = $("#ydayRealCount").val();
data["ydayCancelCount"] = $("#ydayCancelCount").val();
data["ydayDelayCount"] = $("#ydayDelayCount").val();
data["ydayDelayTwoCount"] = $("#ydayDelayTwoCount").val();
data["ydayFlightNormalRate"] = $("#ydayFlightNormalRate").val();
data["ZBAAScheduleCount"] = $("#ZBAAScheduleCount").val();
data["ZBAARealCount"] = $("#ZBAARealCount").val();
data["ZBAACancelCount"] = $("#ZBAACancelCount").val();
data["ZBAADelayCount"] = $("#ZBAADelayCount").val();
data["ZBAADelayTowCount"] = $("#ZBAADelayTowCount").val();
data["ReMarkA"] = $("#ReMarkA").val();
data["ReMarkB"] = $("#ReMarkB").val();
data["ReMarkC"] = $("#ReMarkC").val();
data["ReMarkD"] = $("#ReMarkD").val();
data["ReMarkE"] = $("#ReMarkE").val();
data["ReMarkF"] = $("#ReMarkF").val();
$.ajax({
type: "POST",
data: data,
url: "/XX/XXX/XXXX",
cache: false,
success: function (result) {
if (result > 0) {
alert("保存成功!");
}
else {
alert("保存失败,请稍后再试!");
}
}
});
后台 XXXX(CpyNightNew gnn){} //gnn 实体类
三、集合
var _list = {};
for (var air in airport) {
_list["runinfo_airport_racc[" + air + "].Airport"] = airport[air];
_list["runinfo_airport_racc[" + air + "].ActualCount"] = $("#" + airport[air] + "_ActualCount_Z").val();
_list["runinfo_airport_racc[" + air + "].NormalRate"] = $("#" + airport[air] + "_NormalRate_Z").val();
_list["runinfo_airport_racc[" + air + "].Delays"] = $("#" + airport[air] + "_Delays_Z").val();
_list["runinfo_airport_racc[" + air + "].ProblemCauses"] = $("#" + airport[air] + "_ProblemCauses_Z").val();
_list["runinfo_airport_racc[" + air + "].Days_Type"] = "Z";
_list["runinfo_airport_racc[" + air + "].isair"] = 1;
}
$.ajax({
url: '/XX/XXX/XXXX',
data: _list,
dataType: "text",
type: "POST",
traditional: true,
success: function (responseJSON) {
if (responseJSON > 0) {
alert("更新成功!");
}
else {
alert("更新失败,请稍后再试!");
}
}
});
后台 XXXX(List<runinfo_airport_racc> runinfo_airport_racc) //runinfo_airport_racc 集合