locked
DataTables warning: table id=Table1- Ajax error. For more information about this error, please see http://datatables.net/tn/7 RRS feed

  • Question

  • User454532110 posted

    Hi All,

    I am getting this error while retrieving data from ajax request in asp.net mvc. 

    Error message :

    DataTables warning: table id=Emailstable - Ajax error. For more information about this error, please see http://datatables.net/tn/7

    View page:

    @model FranceInvoiceWorkflow.Models.FR_WF_EMAIL_DETAILS
    @{
        ViewBag.Title = "Email details";
    }

    <h2>France Invoice Workflow Creation Dashboard</h2>


    <a class="btn btn-outline-dark" onclick="PopupForm('@Url.Action("AddOrEdit","Dashboard")')">Add New</a>
    <br />
    <table id="Emailstable" class="table table-striped table-bordered" style="width:100%">
        <thead>
            <tr>
                <th>ID</th>
                <th>Email GUID</th>
                <th>Received From</th>
                <th>Received Date </th>

                <th>Email Status</th>
                <th>Filename</th>
            </tr>
        </thead>
    </table>

    @*<link href="//cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet"/>  @*not removing due to grid design*@
    <link href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap.min.css" rel="stylesheet" />

    @section scripts{
        <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
        <script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap.min.js"></script> @*not adding due to grid design*@
        <script>
            var Popup, datatable;
            $(document).ready(function () {
                debugger;
               
                datatable = $("#Emailstable").DataTable ( {             
                    "ajax": {
                        "url": "/Dashboard/GetData",
                        "type": "GET",
                        "datatype": "json"
                    },
                   
                    "columns": [
                        { "data": "ID" },
                        { "data": "EMAIL_GUID" },
                        { "data": "FROM_EMAIL" },
                        { "data": "RECEIVED_DATE" },
                        { "data": "STATUS" },
                        { "data": "FILENAME" }
                    ],
                    "language": {

                        "emptytable": "No Data Found"
                    }

                });
            });


            function PopupForm(url) {

                var formDiv = $('<div/>');
                $.get(url)
                    .done(function (response) {
                        formDiv.html(response);
                        Popup = formDiv.dialog({
                            autoOpen: true,
                            resizable: false,
                            title: 'Invoice details',
                            height: 500,
                            width: 700,
                            close: function () {


                                Popup.dialog('destroy').remove();
                            }

                        });
                    });
            }

        </script>


    }

    Controller :

    public ActionResult GetData()
            {

                using (DBModel db = new DBModel())
                {

                    List<FR_WF_EMAIL_DETAILS> Emaillist = db.FR_WF_EMAIL_DETAILS.ToList<FR_WF_EMAIL_DETAILS>();
                    return Json(new { data = Emaillist }, JsonRequestBehavior.AllowGet);
                }
            }

    Monday, May 31, 2021 1:34 PM

All replies

  • User-474980206 posted

    Use the browser debug tools (network trace) to see the error response from the server. 

    Monday, May 31, 2021 2:16 PM
  • User-1545767719 posted

    Did you see the link? Did you try to find the cause of problem according to the instruction given in the link? If so what is the result?

    Tuesday, June 1, 2021 12:22 AM
  • User287926715 posted

    Hi NS1988,

    NS1988

    DataTables warning: table id=Emailstable - Ajax error. For more information about this error, please see http://datatables.net/tn/7

    You can troubleshoot according to the method described in the link.First visit Chrome’s developer console, refresh the page to allow Chrome to capture all requests, and double-click the Ajax request sentand then you can know what the server error is in response to the Ajax request.

    Best Regards,

    ChaoDeng

    Tuesday, June 1, 2021 3:12 AM