I make a jquery ajax call, the action method is called and returns data, but the result is Internal Server Error.
Could you please shed light on this problem?
Here is the code:
$.ajax({
url: "/Post/GetFieldInformation",
data: { feedID: feedID, asUserID: $('#AsUserID').val(), fieldHandled: @Html.Raw(JsonConvert.SerializeObject(Model.FieldHandled)) },
type: 'GET',
dataType: "json",
contentType: 'application/json; charset=utf-8',
success: function (mydata) {
alert("success");
},
error: function (request, status, error) {
alert(error);
}
});
Action Method:
[HttpGet]
public JsonResult GetFieldInformation(string feedID, int asUserID, Dictionary<int, bool> fieldHandled)
{
FieldInformation result = new FieldInformation();
string[] feedIDs = new string[] { feedID };
result.Fields = dr.UserFields(this.RequestCultureID, asUserID, feedIDs, new string[0], !base.CurrentUserSessionInfo.FeatureAllOptionalFields);
result.SpecificFields = result.Fields.Where(p => p.Key > 1000 && p.Value.FeedUsing == 1 && !fieldHandled.ContainsKey(p.Key))
.OrderBy(p => p.Value.SortOrder).ThenBy(p => p.Value.FieldTypeID).ThenBy(p => p.Value.FieldLabel);
return Json(result, JsonRequestBehavior.AllowGet);
}
Here is the response text: �ZmS�H��U�z�u���e��qrxo��b.�����6�2��fF����…�q��\�9���Z����9�i=ȇ���9C�