function SubminFenPei() {
var ExamTimeValue = $("#ExamTime").val();
if (ExamTimeValue==-1) {
alert("请选择要分配考场的考期!");
return;
}
alert(ExamTimeValue);
//添加考场缓存数据
var bool = "";
$.ajax({
type: "get",
url: "KaoChang/Index",
data: { Eid: ExamTimeValue },
dataType: 'json',
async: false,
success: function (data) {
alert(data.IsSuccess);
if (data.IsSuccess) {
bool = data.Message;
} else {
bool = data.Message;
}
}
});
alert(bool);
}
控制器:
[HttpGet]
public ActionResult Index(int Eid=0)
{
ViewData["ExamTimeData"] = new ExamTimeBLL().GetExamTimeList();
if (Eid == 0)
{
return View();
}
ResultModel result = new ResultModel();
result.IsSuccess = true;
result.Message = "缓存添加成功!";
return Json(result, JsonRequestBehavior.AllowGet);
//string biaoshi = AddKaochangCache(Eid);
//if (biaoshi == "ok")
//{
// return Content("{state:1,msg:'缓存添加成功!'}");
//}
//return Content("{state:0,msg:'" + biaoshi + "'}");
}