title: Ajax calling Area Controller
body: <p>I am trying to call a Controller from Ajax, but I'm getting:</p>
  
  <blockquote>
    <p>Failed to load resource: the server responded with a status of 404 ()</p>
  </blockquote>
  
  <p>The Ajax is calling from the Admin View to the Admin Controller. I can view the Admin Page, but I'm unable to call GetAll() and GetAllUsers() from Ajax or any other method.</p>
  
  <p>In Startup</p>
  
  <pre><code>        app.UseMvc(routes =&gt;
          {
  
              routes.MapRoute("areaRoute",template:"{area:exists}/{controller=Admin}/{action=Index}/{id?}");
  
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
  </code></pre>
  
  <p>In AdminController</p>
  
  <pre><code>namespace Project.Areas.Admin.Controllers
  {
      [Area("Admin")]
      [Authorize(Policy = "AdminOnly")]
      public class AdminController : Controller
      {    
          public IActionResult Index()
          {
              return View();
          }
          public AdminController()
          {        
          }
          [HttpGet("GetAll/{page}")]
          public IActionResult GetAll(int? page)
          {           
          }
          [HttpGet("GetAllUsers/{page}")]
          public IActionResult GetAllUsers(int? page)
          {         
          }
      }
  }
  </code></pre>
  
  <p>Ajax:</p>
  
  <pre><code>@section Scripts{ 
      @await Html.PartialAsync("_ValidationScriptsPartial")
      &lt;script&gt;
          $(function () {
              $.ajax({
                  type: "GET",
                  url: "/Admin/GetAll",                
                  traditional: true,
                  success: function (view) {
                      $("Result").html(view)
                  }
              });
  
              $.ajax({
                  type: "GET",
                  url: "/Admin/GetAllUsers",
                  traditional: true,
                  success: function (view) {
                      $("userResult").html(view)
                  }
              });
          });
      &lt;/script&gt;
  }
  </code></pre>