I have been facing a challenge with my AJAX implementation as I am still new to using it. The problem arises when trying to reach the C# method it should call - even after setting a breakpoint, the code is never reached and no errors are displayed.
While debugging with FireBug, I confirmed that the getCheckBoxes
function is being called and executed.
The C# method I am trying to execute with AJAX is located in TestScriptResultsController
. Despite removing the internal code, the method remains unreachable. I have attempted both POST
and GET
methods without success. Any assistance would be greatly appreciated.
getCheckBoxes = function getCheckBoxes () {
//var firstDate = '@Model.FirstDate';
//var lastDate = '@Model.LastDate';
var fDateChanged = $("#FirstDate").datepicker('getDate');
var lDateChanged = $("#LastDate").datepicker('getDate');
var platformConfig = '@Model.PlatformConfigSelected';
var triggered = '@Model.TriggeredSelected';
$.ajax({
url: '@Url.Action("BranchCheckBoxes", "TestScriptResults")',
type: 'POST',
data: { fDateChanged: firstDate, lDateChanged: lastDate, platformConfig: platformConfig, triggered: triggered },
success: function (data) { $('#checkBoxes').html(data); }
});
}
The controller action :
public ActionResult BranchCheckBoxes(DateTime firstDate, DateTime lastDate, string platformConfig, string triggered)
{
return PartialView(trs);
}