DataTables warning: table id=tblSemesters - Ajax error. For more information about this error,

DataTables warning: table id=tblSemesters - Ajax error. For more information about this error,

danish47danish47 Posts: 3Questions: 2Answers: 0

Hi I am getting this below error i am using it as first time .
"DataTables warning: table id=tblSemesters - Ajax error. For more information about this error, please see http://datatables.net/tn/7"
below is my code , I have no entity data model rather i put my class in dbContext as shown below


public ActionResult Index1()
{

        return View();


    }
    public ActionResult GetList()
    {

        using (DatabaseContext es = new DatabaseContext())
        {
            var SemesterList = es.Semesters.ToList<Semesters>();
            return Json(new { data = SemesterList }, JsonRequestBehavior.AllowGet);
        }

}

Index1 view

@{
ViewBag.Title = "Semester List";
Layout = "~/Views/Shared/_Layout2.cshtml";
}

Semester List

Semester_Title Duration Status Start Date End Date Fall Session Program Year Created By

<link href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" />

<link rel="//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css" type="text/css" />
@section scripts
{

<script>
$(document).ready(function () {
    $("#tblSemesters").DataTable({
    "ajax": {
        "url": "/Semesters/GetList",
        "type": "POST",
        "processing": true,
        "serverSide": true,
      "datetype": "json"
    },
    "columns": [
        { "data": "Semester_Title" },
        { "data": "Semester_Duration_In_Weeks" },
        { "data": "Status" },
        { "data": "Semester_Start_Date" },
        { "data": "Semester_End_Date" },
        { "data": "Fall_Session" },
        { "data": "Program" },

        { "data": "Year" },
        { "data": "Added_By" },
    ]
  });
});
</script>

}

Answers

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    The link provided in the error message shows diagnostic steps to be taken. That would be the place to start debugging.

  • danish47danish47 Posts: 3Questions: 2Answers: 0

    Thanks Tangerine I got the result by debugging , Now I have a question in my semester table I have DepartmentID , but on grid i want to show department name from department table with this id i have already nevigation property of department so how to achieve it .
    [ForeignKey("Department")]
    public virtual Department departments{ get; set; }
    [Display(Name = "Department")]
    [Required(ErrorMessage = "Program selection is required field!")]
    public int Department { get; set; }

This discussion has been closed.