I've looked at the previously-posted jQuery/MVC questions and haven't found a workable answer.
I have the following JavaScript code:
appCode.runReports = function (e) {
var reportList = '';
$('.rptCheck:checked').each(function (index) {
reportList += ($(this).attr('reportName') + ',');
});
$.ajax({
url: '/Report/RunReports/?reports=' + reportList,
error: appCode.reportAjaxFailure,
success: appCode.listRunningReports,
complete: appCode.ajaxComplete,
dataType: 'json'
});
e.preventDefault();
}
$(document).ready(function () {
$('#runReportsButton').click(appCode.runReports);
});
The URL it calls into uses the following controller:
namespace workflowDemoMVC.Controllers
{
public class ReportController : Controller
{
public JsonResult RunReports(string reports = "")
{
try
{
var ret = reports.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return Json(ret, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
ide.Trace.WriteLine(ex.ToString());
return Json(null, JsonRequestBehavior.AllowGet);
}
}
}
}
When I run the code in dev, the controller action executes as expected and returns, but none of the callbacks defined in the AJAX call (complete, error, or success) fire. Once, in an earlier code version, I saw an 500-coded exception (Internal Server Error,) but now I don't see anything at all.
Environment: MVC3, jQuery1.6 .net4