I have stripped my getJSON call to the simplest example possible trying to figure out why it’s not working but I’m out of ideas. I currently have:
public JsonResult MyAction()
{
return Json(new { status = "OK" });
}
$.getJSON('MyController/MyAction', function(result) { alert('worked'); });
The action is called, but the alert does not get fired and looking in Chrome developer tools I see a Status 500 error code is returned. What can possibly be causing this? How can I debug it?
By default MVC 2.0 blocks GET requests to actions that return a
JsonResult.Use
JsonRequestBehavior.AllowGetto force the issue, or use POST.Or use post: