Moti Mashiah
asked on
Json and asp.net mvc
Hi Guys,
I'm returning json to the view:
Here is my controller method:
What I would like to do it to return my data with the attribute data.
like before the params I need to have data: please look the example below:
{ "data": [{"name_en":"hello","phone ":"5555555 5","email" :"a.shouma n","facebo ok":"https:\/\/www.facebook.com"},.. .] }
I'm returning json to the view:
Here is my controller method:
public JsonResult Returnjson()
{
RMSmasterDBtestEntities db = new RMSmasterDBtestEntities();
var q = db.Items.Select(a => new Class1
{
Itemlookupcod = a.ItemLookupCode,
Description = a.Description
}).Take(10).ToList();
return Json(q, JsonRequestBehavior.AllowGet);
}
This is my script: $(document).ready(function () {
var dt = $('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": ("Returnjson"),
"columns": [
{
"class": "details-control",
"orderable": false,
"data": null,
"defaultContent": ""
},
{ "data": "Itemlookup" },
{ "data": "Description" }
],
"order": [[1, 'asc']]
});
What I would like to do it to return my data with the attribute data.
like before the params I need to have data: please look the example below:
{ "data": [{"name_en":"hello","phone
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER