0
我有這樣的控制器:爲什麼我的行動結果給我一個404?
public class ActivityController : Controller
{
// GET: Activity
[HttpGet]
public ActionResult ProfessionalActivityForm()
{
return View(new Activity());
}
public ActionResult TradeShow()
{
return PartialView("_AddTradeShow");
}
public ActionResult InsertTradeShow(TradeShow TradeShow)
{
TradeShow.Insert(TradeShow);
return Content("Trade Show submitted successfully");
}
public ActionResult Conference()
{
return PartialView("_AddConference");
}
public ActionResult InsertConference(Conference Conference)
{
Conference.Insert(Conference);
return Content("Conference submitted successfully");
}
}
,當我做了一個/Activity/Conference
我GET
讓我的部分觀點還給我就好了。然後,如果我切換此控制器中的代碼,以使會議出現在TradeShow之前,那麼我會得到相反的結果 - 會議404和TradeShow的工作分部視圖。
這是爲什麼?好像我失去了一些東西在這裏根本...
這裏是jQuery的我使用AJAX:
$('#ConferenceButton').on('click', function() {
$.ajax({
type: "GET",
url: '/Activity/Conference',
success: function (data, textStatus, jqXHR) {
$('#partialViewContainer').html(data);
$('.focusMe').focus();
//var top = $('.focusMe').offset().top;
//$("html, body").animate({ scrollTop: top }, 700);
}
});
});
$('#TradeShowButton').on('click', function() {
$.ajax({
type: "GET",
url: '/Activity/TradeShow',
success: function (data, textStatus, jqXHR) {
$('#partialViewContainer').html(data);
$('.focusMe').focus();
//var top = $('.focusMe').offset().top;
//$("html, body").animate({ scrollTop: top }, 700);
}
});
});
嘗試在你'$ .ajax'能指定'的dataType = 「HTML」'是默認智能猜測可以gess什麼來自控制器。 –