Hi Sir,
I have a controller which sends json data to a view and the view supposed to grab that json data and display in the datatable Ajax. but instead view is displaying just RAW json data.
my Controller code is -
- public ActionResult Index2()
- {
- using (Model_Test dbObj = new Model_Test())
- {
- List
testList = dbObj.Test_Table.ToList (); - var obj = new { data = testList };
- return Json(obj, JsonRequestBehavior.AllowGet);
- }
- }
my View code is -
- @{
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
"abc" class="display">
Id Name Address
- "~/Content/jquery.dataTables.min.css" rel="stylesheet" />
- @section Scripts{
- }
I tested the datatable with static data and it works fine. so it should be something to do with controller json output. Please help me I am so stuck.
Thanks
Katrell GrahamPosted Jul 10, 2019, 12:32 PM
Saminda KotinkaduwaPosted Jun 29, 2018, 11:57 AM
Sanwar RanwaPosted Jun 29, 2018, 8:19 AM
How to retrive data using ajax in asp.net