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什么来自控制器。 –