Anonymous types and System.Web.Mvc.JsonResult issue?
Wow, this is driving me utterly insane. Take a look at the two versions of this code:
Pretty simple right? I left out some stuff for brevity, but I have a very simple subclass defined called JsonJob into which I copy the properties from the Linq Object. Version 2:So, more brief. Selects data using Linq, returns an anonymous type which I push out as a JsonResult.Technically these two should work the same way. Why does Json() care about type? But it seems that for me, anonymous types create malformed Json or something. Here's my AJAX request using jQuery: Again, pretty simple. But if I use Version 2, the error callback is triggered every time (with no error defined!).Of course everyone says This Doesn't Happen For Me (tm), but that's no help.