私はMVC3で作業しています。以下は私のコントローラーです:
public ActionResult TRUnutilizedOwnership(string strGeo, string strVertical, int ? intMonth, int ? intFlag) {
if (strVertical == null) {
strVertical = "All";
}
if (strVertical == "All") {
intFlag = 1;
} else {
intFlag = 2;
}
if (intMonth == null) {
intMonth = 5;
}
TRUnutilizedOwnershipModel oTRUnutilizedOwnershipModel = new TRUnutilizedOwnershipModel();
TravelReadyCommonEntities objTRCommonEntities = new TravelReadyCommonEntities();
TRUnutilizedOwnershipEntities objTRUnutilizedOwnershipEntities = new TRUnutilizedOwnershipEntities();
try {
oTRUnutilizedOwnershipModel.lstGeoEntity = oTRUnutilizedOwnershipModel.GetGeoVertical(strGeo, intFlag);
if (strGeo == null) {
strGeo = oTRUnutilizedOwnershipModel.lstGeoEntity[0].Geo;
}
oTRUnutilizedOwnershipModel = oTRUnutilizedOwnershipModel.GetUnutilizedOwnership(strGeo, strVertical, intMonth, intFlag);
oTRUnutilizedOwnershipModel.lstGeoEntity = oTRUnutilizedOwnershipModel.GetGeoVertical(strGeo, intFlag);
oTRUnutilizedOwnershipModel.lstVerticalEntity = oTRUnutilizedOwnershipModel.GetGeoVerticalChange(strGeo, 2);
oTRUnutilizedOwnershipModel.lstMonthEntity = oTRUnutilizedOwnershipModel.GetMonth();
return View(oTRUnutilizedOwnershipModel);
} catch (Exception ex) {
ILogManager LogManager = new LogManager();
var frame = new StackFrame(0);
LogManager.CallLogging(frame, ex.Message, ex.StackTrace);
return RedirectToAction("Error", "Common");
}
}
そして、私は次のjQueryを使用しています。
function Dispalymaingrid() {
var Geo = $('#ddlGeo').val();
var Vertical = $('#ddlVertical').val();
var Month = $('#ddlMonth').val();
if (Vertical == "All") {
var Flag = 1;
} else {
var Flag = 2;
}
$.ajax({
url: "@Url.Action("
TRUnutilizedOwnership ", "
TravelReady ")",
datatype: "json",
type: "post",
data: {
strGeo: Geo,
strVertical: Vertical,
intMonth: Month,
intFlag: Flag
},
error: function () {},
success: function (result) {
debugger;
//return result;
}
});
}
ドロップダウンからオプションを選択して送信ボタンをクリックすると、ビューページにデフォルトテーブルが表示されます。結果の値でテーブル データを更新する必要があります。
jQuery の成功関数で何を指定する必要がありますか (テーブル コンテンツのみが更新されます)。