I'm hitting the "error" part of this ajax call, seeing "'error in btnTestProduceUsageSettings'":
$("#btnTestProduceUsageSettings").click(function () {
var dom = $('#dayofmonthselect').val();
var ord = $('#ordinalselect').val();
var dow = $('#dayofweekselect').val();
var wom = $('#weekormonthselect').val();
var daterangefromval = $('#produsagefrom').val();
var daterangetoval = $('#produsageto').val();
var unitval = $('#unitsselect').val();
var reportId = 1;
$.ajax({
type: 'GET',
url: '@Url.Action("GetTestSettingVals", "TestSettings")',
data: { unit: unitval, report: reportId, dayofmonth: dom, ordinal: ord, dayofweek: dow,
weekormonth: wom, fromval: daterangefromval, toval: daterangetoval },
cache: false,
success: function (returneddata) {
var nextgendate = returneddata.testsettings.NextGenDate;
var nextfromdate = returneddata.testsettings.NextFromDate;
var nexttodate = returneddata.testsettings.NextToDate;
alert('If you save the current configuration, the Produce Usage report would next be sent on ' + nextgendate + ' and cover data from ' + nextfromdate + ' to ' + nexttodate);
},
error: function () {
alert('error in btnTestProduceUsageSettings');
}
});
});
JSLint doesn't find anything really wrong with it (beyond its usual nitpickiness). At least one of the params is always null. I wondered it that was the problem, but I tried this, just to make sure the null values were not causing the problem:
. . .
var ord = ''; //$('#ordinalselect').val();
var dow = ''; //$('#dayofweekselect').val();
var wom = ''; //$('#weekormonthselect').val();
. . .
...and it still failed.
The Controller method that is supposed to be called isn't being reached at all because of the failure. It is defined:
public JsonResult GetTestSettingVals(string unit, int RptID, string dayOfMonthGen,
string ordinalGen, string dayOfWeekGen, string weekOrMonthGen,
int fromIntDateRange, int toIntDateRange)
So stepping through the code, with a breakpoint in Chrom Dev Tools, I reach the "$.ajax({" line, but not the breakpoint in the Controller method (in Visual Studio), which has one on the last line shown below:
public class TestSettingsController : Controller
{
public JsonResult GetTestSettingVals(string unit, int RptID, string dayOfMonthGen, string ordinalGen, string dayOfWeekGen, string weekOrMonthGen, int fromIntDateRange, int toIntDateRange)
{
TestSettingsModel model = new TestSettingsModel();
I have other ajax/controller combinations designed the same way that work fine, so I can't see what the hangup is here...am I missing an either obvious or well-concealed problem here?
What I have tried:
I wondered if sending some null vals might be the problem, but I tried this, just to make sure the null values were not causing the problem:
. . .
var ord = ''; //$('#ordinalselect').val();
var dow = ''; //$('#dayofweekselect').val();
var wom = ''; //$('#weekormonthselect').val();
. . .
...and it still failed.
The Controller method that is supposed to be called isn't being reached at all because of the failure. It is defined:
public JsonResult GetTestSettingVals(string unit, int RptID, string dayOfMonthGen,
string ordinalGen, string dayOfWeekGen, string weekOrMonthGen,
int fromIntDateRange, int toIntDateRange)
So stepping through the code, with a breakpoint in Chrom Dev Tools, I reach the "$.ajax({" line, but not the breakpoint in the Controller method (in Visual Studio), which has one on the last line shown below:
public class TestSettingsController : Controller
{
public JsonResult GetTestSettingVals(string unit, int RptID, string dayOfMonthGen, string ordinalGen, string dayOfWeekGen, string weekOrMonthGen, int fromIntDateRange, int toIntDateRange)
{
TestSettingsModel model = new TestSettingsModel();
I have other ajax/controller combinations designed the same way that work fine, so I can't see what the hangup is here...am I missing an either obvious or well-concealed problem here?