Json: Returning List of Objects In Ajax call 500 error
I'm having trouble with an ajax call. When I try to pass a string in it works, but when I try to pass a list of objects in it does not work? I tried debugging and the list is definitely populated. But when I try running it with a list I keep getting a 500 (Internal Server Error)? Any suggestions would be very much appreciated!!
Ajax Call:
$(function () {
$('input[type=checkbox]').change(
function () {
if (this.checked) {
$.post("/Authentication/GetProfiles", {}, function (profiles) {
alert("success")
});
}
});
});
controller:
public ActionResult GetProfiles()
{
ProfileManager pm = new ProfileManager(@"Data Source=.\sqlexpress;Initial Catalog='Profiles';Integrated Security=True");
var profiles = pm.GetProfiles();
return Json(profiles);
}