Invalid JSON response. For more information about this error, please see

Invalid JSON response. For more information about this error, please see

jrowan20jrowan20 Posts: 7Questions: 3Answers: 0

Hi All I am running into an invalid JSON error. Everythign was working perfect on Localhost, but now the site is on IIS the things broken. See below my jquery, network response and controller

namespace MaskFit.Controllers

    public class MaskController : Controller

        private readonly ApplicationDbContext _db;

        public MaskController(ApplicationDbContext db)

            _db = db;



        public async Task<IActionResult> GetAll()
            return Json(new { data = await _db.Mask.ToListAsync() });

        public async Task<IActionResult> Delete(int id)
            var maskFromDb = await _db.Mask.FirstOrDefaultAsync(u => u.Id == id);
            if (maskFromDb == null)
                return Json(new { success = false, message = "Error Whilst Deleting" });
            await _db.SaveChangesAsync();
            return Json(new { success = true, message = "Delete Successful" });
var dataTable

$(document).ready(function () {

function loadDataTable() {
    dataTable = $('#DT-load').DataTable({
        "ajax": {
            "url": "/mask",
            "type": "GET",
            "datatype": "json",

        "columns": [
            { "data": "name", "width": "20%" },
            { "data": "author", "width": "20%" },
            { "data": "isbn", "width": "20%" },

                "data": "id",
                "render": function (data) {
                    return `<div class="text-center">
                <a href="/MaskList/Edit?id=${data}" class='btn btn-success text-white' style='cursor:pointer; width:70px;'>
            <a  class='btn btn-danger text-white mx-auto' style='cursor:pointer; width:70px;'
                }, "width": "40"

        "language": {
            "emptyTable": "No Data found"
        "width": "100%"



//Sweet Alert Function

function Delete(url) {
        title: "Are you sure?",
        text: "Once Delete you will not be able to recover",
        icon: "warning",
        buttons: true,
        dangerMode: true
    }).then((willDelete) => {
        if (willDelete) {
                type: "DELETE",
                url: url,
                success: function (data) {
                    if (data.success) {
                    else {


Request URL: http://odgh-webapp-uat/masks?_=1604435258024
Request Method: GET
Status Code: 200 OK
Remote Address:
Referrer Policy: strict-origin-when-cross-origin
Content-Type: text/html; charset=utf-8
Date: Tue, 03 Nov 2020 20:27:36 GMT
Server: Microsoft-IIS/10.0
Transfer-Encoding: chunked
X-Powered-By: ASP.NET
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en;q=0.9,en-US;q=0.8
Connection: keep-alive
Cookie: .AspNetCore.Antiforgery.6A-HjuGlSgs=CfDJ8FCglAuCLlJGqq2XVQMUUAUSieaecoWLJn7jobDBfMTOjwq6Zt8QUnrQJ7nS_GGmILzcdiyPJZG57YAQjb9R20dqsl9bbTc_mcmCwWDitum3mzfCW6Hz40GleUM8pqCY1ddr0isyCFOTohiI09hlJ4o
Host: odgh-webapp-uat
Referer: http://odgh-webapp-uat/masks/MaskList
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.61
X-Requested-With: XMLHttpRequest

Is there anything obvious that I may be missing thank you


  • colincolin Posts: 12,657Questions: 0Answers: 2,163

    The best place to start would be to follow the diagnostic steps in the error message: .

    Have you tried that? What did you find?


  • hellodevinghellodeving Posts: 2Questions: 0Answers: 0

    DataTables warning: table id=user-list - Invalid JSON response. For more information about this error, please see

  • hellodevinghellodeving Posts: 2Questions: 0Answers: 0

    how to resolve ?

  • kthorngrenkthorngren Posts: 13,817Questions: 25Answers: 3,252

    As Colin suggested, have you followed the troubleshooting steps in the link provided?

    The response is coming from the server so you will need to troubleshoot what is happening at the server. The JSON response might indicate the error or you will need to review your server logs.


Sign In or Register to comment.