function Save() {
var examId = '%=ExamId %>';
var yearTerm = $("#%=DDLYearTerm.ClientID %>").val();
var examType = $("#%=DDLExamType.ClientID %>").val();
var examDate = $("#ExamDate").val();
var examName = $("#ExamName").val();
var exam = {};
exam["ExamId"] = examId;
exam["YearTerm"] = yearTerm;
exam["ExamType"] = examType;
exam["ExamDate"] = examDate;
exam["ExamName"] = examName;
var json = $.toJSON(exam);
var Result = AjaxController.EditExam(json).value;
if (Result == "Success")
{
alert("保存成功");
parent.$.fancybox.close();
}
else
{
alert(Result);
}
}
然后我們在后臺,進行反序列化,并使用值.因為我們使用ajax所以要在后臺的方法上加上[Ajax.AjaxMethod]特性,并且在你前臺所在頁面的cs里面也要加上Ajax的注冊.具體使用看