title: Sitecore MVC Ajax resource not found
body: <p>I have a clean install of Sitecore 7.5 with MVC and I am trying to do a simple Ajax call but I am getting a 404 at runtime. The controller rendering renders just fine but when I fire the Ajax call by selecting an option from the dropdown, I get the error:</p>
  
  <p>GET [domain name url]/api/BookDetailsController/GetBookDetails 404 (Not Found)</p>
  
  <p>Any help is much appreciated, thank you.</p>
  
  <p><strong>RouteConfig.cs:</strong></p>
  
  <pre><code>using System.Web.Mvc;
  using System.Web.Routing;
  
  namespace Website.Routes
  {
  public class RouteConfig
  {
      public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "api/{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
          );
  
          routes.MapRoute(
              name: "BookDetailsController",
              url: "api/BookDetailsController/GetBookDetails",
              defaults: new { controller = "BookDetailsController", action = "GetBookDetails" }
          );
      }
  }
  }
  </code></pre>
  
  <p><strong>Global.asax.cs:</strong></p>
  
  <pre><code>using System.Web.Http;
  using System.Web.Mvc;
  using System.Web.Routing;
  
  namespace sc75rev141003
  {
  // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
  // visit http://go.microsoft.com/?LinkId=9394801
  public class MvcApplication : System.Web.HttpApplication
  {
      protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();
  
          WebApiConfig.Register(GlobalConfiguration.Configuration);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          Website.Routes.RouteConfig.RegisterRoutes(RouteTable.Routes);
      }
  }
  }
  </code></pre>
  
  <p><strong>Simple View with Ajax call:</strong></p>
  
  <pre><code>@using System.Web.Mvc
  
  Select Any Book :
  @Html.DropDownList("Books")
  
  &lt;div id="BookDetail" style="white-space: pre;"&gt;
  
  &lt;/div&gt;
  
  &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.js"&gt;      &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(function () {
      $("#Books").bind("keyup change", function () {
          var itemId = $(this).val();
          if (itemId != "") {
              $.getJSON("api/BookDetailsController/GetBookDetails",
                  function(data) {
                      var BookString = "Book Title: " + data.BookTitle + "\n" + "Book Author: " + data.BookAuthor + "\n" + "Book Language:" + data.BookLanguage;
                      $("#BookDetail").text(BookString);
                      console.log("success", data);
                  });
          }
          else {
              $("#BookDetail").text("");
          }
      });
  });
  &lt;/script&gt;
  </code></pre>