In my MVC Kendo-Grid web app, I need to periodically see if certain data in the underlying database has expired. If it has, then I modify the data in the database and the normal "refresh" cycle of the Grid updates the displayed data. So, here is my server-side method, contained in my GridController.cs (from the "Controller" part of MVC), abridged:
namespace WireDashboard2.Controllers
{
public partial class GridController : Controller
{
....
[System.Web.Services.WebMethod]
public static void ReviewSuspensions()
{
... do some database stuff ....
}
....
}
And here is the client-side JavaScript method that is supposed to be calling GridController.ReviewSuspensions() method:
function Check4ExpiredSuspensions() {
$.ajax({
url: '@Url.Action("GridController", "ReviewSuspensions")',
success: function() {
alert("Reviewed Suspensions successfully!");
},
error: function() {
alert('Did NOT review Suspensions successfully.');
}
}); // GET http://localhost:63794/GridController/ReviewSuspensions 404 (Not Found)
}
I know the "Check4ExpiredSuspensions() JavaScript is being called on the client-side, because it is attempting to invoke the method, resulting in a 404 (Not Found) error being returned. That JavaScript function is from the WireDashbard2\Views\Home\Index.cshtml file (the "View" part of MVC).
I've tried literally a dozen modifications of the Client-Side and Server-Side (based on lots of different methods found online), and it never hits a breakpoint in the server-side method. Most of those methods look like FM to me because I don't have a good handle on the mapping between the "web" reference to the GridController and Check4Suspensions() method as viewed from the client side - so I am mostly just trying to match up from examples.
I inherited the web app, and it is a combination of Microsoft C# Windows web application now using .NET 4.6.2, Entity Framework 6.x, JQuery 3, Kendo UI for JQuery MVC 2024.1.319, running (in Prod) under WIndows Server 2016 Standard and IIS, so there seems to be plenty of potential for difficult interactions! Problem occurs using both Chrome and Edge (no surprise really there, same engine in both).
Thanks!