ASP.Net MVC AJAX Error: 404.0 - Not Found The resource you are looking for has been removed

Last Reply 3 months ago By dharmendr

Posted 3 months ago

I am having a jquery datatable which is working fine when i am trying to run locally, but when i am publishing it in iis it shows error.

Error: 

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

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

@{
    //Layout = null;
    Layout = "~/Views/Shared/_LayoutPage1.cshtml";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
  
</head>
<body>
    <div class="container" style="margin-top:80px">
        <table id="LandResource" class="ui celled table">
            <thead>
                <tr>
                    <th>S.No</th>
                    <th>CPSE Name</th>
                    <th>State</th>
                    <th>Unit</th>
                    <th>Status</th>
                    <th>Land FreeHold Mutated</th>
                    <th>Land FreeHold Non-Mutated</th>
                    <th>Land Lease Hold</th>
                    <th>Land Total</th>
                </tr>
            </thead>
        </table>
    </div>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/semantic.min.css" />
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.semanticui.min.css" />
    @section Scripts{
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
        <script src="https://cdn.datatables.net/1.10.19/js/dataTables.semanticui.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/semantic.min.js"></script>
        <script>
            $(document).ready(function () {
                $('#LandResource').DataTable({
                    "ajax": {
                        "url": "/Reports/LoadData",
                        "type": "GET",
                        "dataType": "json"
                    },
                    "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                        var oSettings = this.fnSettings();
                        $("td:first", nRow).html(oSettings._iDisplayStart + iDisplayIndex + 1);
                        return nRow;
                    },
                    "columns": [
                        { "data": null, "autoWidth": true },
                        { "data": "CPSE_id", "autoWidth": true },
                        { "data": "CPSE_StateName", "autoWidth": true },
                        { "data": "CPSE_Unit_Name", "autoWidth": true },
                        { "data": "Land_Status", "autoWidth": true },
                        { "data": "LandFreeHold_Mutated", "autoWidth": true },
                        { "data": "LandFreeHold_NonMutated", "autoWidth": true },
                        { "data": "LandLeaseHold", "autoWidth": true },
                        { "data": "LandTotal", "autoWidth": true }
                    ]
                });
            });

        </script>
    }
</body>
</html>

 

You are viewing reply posted by: dharmendr 3 months ago.
Posted 3 months ago

Hi sunnyk21,

HTTP Error 404.0 - Not Found error means the URL requested was not found on the server.

You need to use absolute path.

You can change

"url":'@Url.Action("LoadData","Reports")',

instead of

"url": "/Reports/LoadData",