我想重定向到控制器功能中的另一個視圖。返回視圖無法正常工作
這裏是我的代碼 鑑於:
$.ajax({
type: "POST",
url: '@Url.Action("CreateEBulletinPdf","EBulletin")',
contentType: "application/json",
dataType: "JSON",
data: JSON.stringify({ "productIdList": selectedProductIdList }),
success: function (result) {
}
});
在控制器:
public void CreateEBulletinPdf(string productIdList)
{
productIdList = productIdList.Substring(0, productIdList.Length - 1);
var productIdStrings = productIdList.Split(',');
detailViewModels = productIdStrings.Select(productIdString => PdfProduct(Convert.ToInt32(productIdString))).ToList();
ProductsEBulletin();
}
public ActionResult ProductsEBulletin()
{
try
{
return View(detailViewModels);
}
catch (Exception)
{
throw;
}
}
後,我的所有功能運行,這名ProductsEBulletin不顯示我的目標視圖。我的錯誤在哪裏?
您是否設置了斷點,調試了您的代碼並進行了驗證,它是否被調用並正在工作? – Marco
你的HTTP請求由'CreateEBulletinPdf()'調度,它不返回任何東西('void')。在內部,它確實調用'ProductsEBulletin()'(返回'ActionResult'),但是'CreateEBulletinPdf'不會對它做任何事情。 – haim770
@Marco,是的,我調試我的代碼一切正常.. – cagin