I'm trying to send the queried data gathered from the context back to the ajax caller with the following status
1-The source code server side succeeds querying the data. 2-The source code server side succeeds sending the data in case HTTPPOST or HTTPGET is used 3-No exceptions or errors at the source code 4-applying JSON(queried object) method doesn't make a change The scenario goes as follow:- using ajax call as follows
$.ajax({
type: "POST",
url: '@Url.Action("MainCatItems", "Cachier")',
contentType: "application/json; charset=utf-8",
data: datas,
dataType: "json",
success: successFunc,
error: function (xhr) {
alert('Error: ' + xhr.statusText);
},
});
calling an Action Controller
[HttpPost]
public ActionResult MainCatItems(int mainCatNo)
{
var results = ......//fetching data from Context
return Json(new { data = results }, JsonRequestBehavior.AllowGet);
}
, the call succeeds sending my parameters to the action but sending a response back to the ajax call from the controller is a little bit confusing as I have two cases:
The First: (working perfectly) I'm returning data queried from a table class in my Entity Framework (RegisterNotification Class)
public partial class RegisterNotification
{
//setters and getters
}
which is a single class with no navigational property declared inside
The Second(where the problem is.) I'm returning data queried from a table class in my Entity Framework (Item Class"partial class")
Part One:-
public *partial* class Item
{
// setters and getters
}
Part Two:-
public *partial* class Item
{
//setters and getters
}
which is a partial class with navigational properties declared inside
This case doesn't work and when getting back to the ajax call it alerts the error function message saying an "internal server error 500" I have tried parsing the queried data to a JSON Object in my controller:-
var t = Json(res,"application/json; charset=utf-8",JsonRequestBehavior.AllowGet);
Queried Data at source code server side Watch:
Client Side error message details
But again with failure. Thanks for concerning.