У меня проблема с запросом PartialView с использованием ajax. На мой взгляд, все выглядит так, как будто находят, но ошибка отображается как:
URL запроса: http://localhost:4530/Home/ViewWorld Метод запроса: GET Код состояния: 404 Не найдено
Вот коды:
$.ajax({
url: "Home/ViewWorld", //'@Url.Action("viewWorld", "Home")',
type: "GET",
dataType: "html",
success: function (e) {
alert(e);
},
error: function (error) {
alert(error[0]);
}
});
Мой контроллер выглядит так:
public class HomeController : Controller
{
//
// GET: /Index/
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult ViewWorld()
{
return PartialView("_ContactMe");
}
}
Global.asax:
routes.MapRoute( "Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home",
action = "ViewWorld",
id = UrlParameter.Optional } // Parameter defaults
);
Может кто-нибудь помочьмне выяснить, почему это не работает, спасибо