有一个问题。为了在我的项目中添加新的空缺,我使用 K-MVC
public ActionResult AddVacancy()
{
var viewModel=new VacancyViewModel();
viewModel.AllTechnologies = (from t in _serviceClient.GetTechnologies() select t.Name).ToList();
return View(viewModel);
}
[HttpPost]
public ActionResult AddVacancy(VacancyViewModel viewModel)
{
_serviceClient.AddVacancy(viewModel);
return Json(viewModel);
}
//------------------------------------------------ --------------------------------------
@using PerpetuumSoft.Knockout
@model Core.ViewDataModel.VacancyViewModel
@{
var ko = Html.CreateKnockoutContext();
ViewBag.Title = "New vacancy";
}
...............................
@using (ko.Html.Form("AddVacancy", "Vacancy", ko.Model))
{
...............................................
<p>
<input class="submitButton" type="submit" value="Create" />
</p>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@ko.Apply(Model)
一切正常!感谢 K-MVC!但是,如果我想在成功提交后重定向到另一个操作:
[HttpPost]
public ActionResult AddVacancy(VacancyViewModel viewModel)
{
_serviceClient.AddVacancy(viewModel);
return RedirectToAction("Index");
}
我会收到错误,因为以前的表单没有收到 Ajax.success。我该如何处理这个问题?提前致谢!