ajax中post传值,ajax post传值

  • Post author:
  • Post category:其他


一、字符串

$.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”] = $