Предупреждение DataTables: таблица id = DataTables_Table_0 - Ajax error datatable expres.js - PullRequest
0 голосов
/ 24 октября 2019

Привет, люди, которых я прошу о помощи

У меня есть таблица данных, база данных mysql и экспресс-сервер,

i create an api in express

router.post('/data' , async(req,res)=> {
var tupac=await pool.query("select * from equip  ");




var data=[]
tupac.forEach(function(elementt,element) {

  data[element]={
    test1:elementt.Id_Equipo,
    test2:elementt.Cod_Equipo,
    test3:elementt.Ser_Equipo,
    test4:elementt.Mar_Equipo
  }

});
console.log(req.params);
req.params.draw=1
tupac={
"draw":1,
"recordsFiltered":data.length,
"recordsTotal":data.length,
"data":data}

res.locals.metaTags={title:"playgraund", script:"\\j-playgraund.js"}
console.log(res.locals.head);
  res.send(tupac);
});

, и это мой скрипт

$(".select-test").select2();
$(document).ready(function() {
   $(".table-testing").DataTable({




    processing:true,
  serverSide:true,
ajax:{"url":"192.168.100.109/testing/data", "Type":"POST",
cache:false
},
colums:[{"data":"test1",
"data":"test2",
"data":"test3",
"data":"test4"}]  });
});

и мой HTML

<table class="table-testing">
  <thead>
    <tr>
      <th>test1</th>
      <th>test2</th>
      <th>test3</th>
      <th>test4</th>
    </tr>
  </thead>

</table>

, когда я пытаюсь получить результат на своей веб-странице, я получаю

проблему

как я могу решить эту проблему

это мой ajax

{
    "draw": 1,
    "recordsFiltered": 106,
    "recordsTotal": 106,
    "data": [
        {
            "test1": 31,
            "test2": "qq",
            "test3": "qwdqwd",
            "test4": "qwdqwd"
        },
        {
            "test1": 32,
            "test2": "wqrsw",
            "test3": "wefwe",
            "test4": "wefwef"
        },
        {
            "test1": 33,
            "test2": "QWDQWD",
            "test3": "qwdqwd",
            "test4": "MontenegroQWDQWDWD"
        },
        {
            "test1": 34,
            "test2": "qwqwd",
            "test3": "d",
            "test4": "d32"
        },
        {
            "test1": 35,
            "test2": "TIM85BWX0G",
            "test3": "BUM90HRI2YE",
            "test4": "Litora Torquent Per Industries"
        },
        {
            "test1": 36,
            "test2": "BRH36ESS9G",
            "test3": "GDG44MAF8HN",
            "test4": "Fusce Incorporated"
        },
        {
            "test1": 39,
            "test2": "LCU99CBW8U",
            "test3": "NTA39TFB0YA",
            "test4": "Accumsan Interdum Associates"
        },
        {
            "test1": 40,
            "test2": "VIE09TFN7U",
            "test3": "EDZ42AHZ2BG",
            "test4": "Sed Tortor Foundation"
        },
        {
            "test1": 41,
            "test2": "FIE68XIH7A",
            "test3": "RRD90UYO0ZX",
            "test4": "Molestie LLP"
        },
        {
            "test1": 42,
            "test2": "FFB02ZLX7K",
            "test3": "NGF71GEY6QA",
            "test4": "Quis Arcu Vel Ltd"
        },
        {
            "test1": 43,
            "test2": "GDY71APY7U",
            "test3": "SKP36RKQ6HS",
            "test4": "Velit Justo Company"
        },
        {
            "test1": 44,
            "test2": "SGI67IRR5Q",
            "test3": "BMC71QGM5IG",
            "test4": "Praesent Industries"
        },
        {
            "test1": 45,
            "test2": "GBB93KRI7B",
            "test3": "LIY61WDQ1LV",
            "test4": "Scelerisque Industries"
        },
        {
            "test1": 46,
            "test2": "LKS77ZLS6W",
            "test3": "UNX93WJZ0SC",
            "test4": "Egestas A Dui Limited"
        },
        {
            "test1": 47,
            "test2": "UEF43TML8G",
            "test3": "VNG33HES0SI",
            "test4": "Pede Cras Vulputate LLC"
        },
        {
            "test1": 48,
            "test2": "QQR68YWN2Y",
            "test3": "GRJ29SOP3KK",
            "test4": "Maecenas Malesuada Corp."
        },
        {
            "test1": 49,
            "test2": "BAO29HQD8A",
            "test3": "QEZ65UIC1GI",
            "test4": "Non Egestas A LLP"
        },
        {
            "test1": 50,
            "test2": "JIL02NRX2E",
            "test3": "ROW47OLP1OK",
            "test4": "Mattis Velit Justo Consulting"
        },
        {
            "test1": 51,
            "test2": "DIA05LDG9V",
            "test3": "YKY64OGA8BW",
            "test4": "Aenean Gravida Nunc Incorporated"
        },
        {
            "test1": 52,
            "test2": "INO95LKK6P",
            "test3": "RWP77RRJ7KB",
            "test4": "Purus Company"
        },
        {
            "test1": 53,
            "test2": "IBL16SJB8A",
            "test3": "BGZ48WQF1SL",
            "test4": "Felis Orci PC"
        },
        {
            "test1": 54,
            "test2": "YKG04DJC4C",
            "test3": "NSL30YDA7ML",
            "test4": "Nam Porttitor Scelerisque LLC"
        },
        {
            "test1": 55,
            "test2": "HCX89KPI1P",
            "test3": "WAM70VWF3LR",
            "test4": "Metus Eu Associates"
        },
        {
            "test1": 56,
            "test2": "SRY94SFO9Z",
            "test3": "BLV71PLH4XM",
            "test4": "In LLC"
        },
        {
            "test1": 57,
            "test2": "TMF91QSA8F",
            "test3": "BYI73LZH0MT",
            "test4": "Orci Sem Eget LLP"
        },
        {
            "test1": 58,
            "test2": "ZLU79TEB9A",
            "test3": "TBD79RHY4JK",
            "test4": "Et Magnis Foundation"
        },
        {
            "test1": 59,
            "test2": "CFA91TMH3F",
            "test3": "QBF41SRG8CD",
            "test4": "Vitae Orci Phasellus Corporation"
        },
        {
            "test1": 60,
            "test2": "EQQ87DCZ5U",
            "test3": "HRH25VKA6GB",
            "test4": "Hendrerit A Arcu LLC"
        },
        {
            "test1": 61,
            "test2": "GKM17QBB8Y",
            "test3": "FNK91OBX9KG",
            "test4": "Nullam Lobortis Quam Institute"
        },
        {
            "test1": 62,
            "test2": "YIL53JML1E",
            "test3": "VVT73NBJ6UW",
            "test4": "Hymenaeos Associates"
        },
        {
            "test1": 63,
            "test2": "UAH47KSL8D",
            "test3": "MXJ32PMH0FV",
            "test4": "Cursus A Enim PC"
        },
        {
            "test1": 64,
            "test2": "MMK61NTW5U",
            "test3": "CEF31XNB2SA",
            "test4": "Dignissim Pharetra Company"
        },
        {
            "test1": 65,
            "test2": "GGD47QBK7E",
            "test3": "TEF96NDL7HN",
            "test4": "Sem Semper Erat Industries"
        },
        {
            "test1": 66,
            "test2": "XUW94POD1W",
            "test3": "SLP00TGB4BR",
            "test4": "Mollis Corp."
        },
        {
            "test1": 67,
            "test2": "TJE89KON9H",
            "test3": "KUQ24WUK9XA",
            "test4": "Magna Lorem Ipsum LLC"
        },
        {
            "test1": 68,
            "test2": "SMT35XUY1K",
            "test3": "IDK85TLB6CR",
            "test4": "Massa Industries"
        },
        {
            "test1": 69,
            "test2": "TPQ13QPB0L",
            "test3": "CZG66CNM4SF",
            "test4": "Mauris LLP"
        },
        {
            "test1": 70,
            "test2": "KPK76TNJ0H",
            "test3": "YOR32GNA1XU",
            "test4": "Nec Urna Et PC"
        },
        {
            "test1": 71,
            "test2": "EQZ07OBB6V",
            "test3": "NZX92SGE4AH",
            "test4": "Ultrices Foundation"
        },
        {
            "test1": 72,
            "test2": "XZU78LAB5C",
            "test3": "LMP44CMA7LN",
            "test4": "Auctor Velit Industries"
        },
        {
            "test1": 73,
            "test2": "WRH38ZRZ8Z",
            "test3": "YDX01FHR4ED",
            "test4": "Volutpat Nunc Ltd"
        },
        {
            "test1": 74,
            "test2": "MMH28ETO8M",
            "test3": "ORI75GPE3EL",
            "test4": "Dictum Eu Consulting"
        },
        {
            "test1": 75,
            "test2": "RLN25VMK5U",
            "test3": "DMJ93OUD1BL",
            "test4": "Pede Company"
        },
        {
            "test1": 76,
            "test2": "SHI74DGY4B",
            "test3": "ROX47QSX7UH",
            "test4": "Nunc LLC"
        },
        {
            "test1": 77,
            "test2": "UBF04OFS5K",
            "test3": "KOR68JCV6WB",
            "test4": "Amet Lorem Consulting"
        },
        {
            "test1": 78,
            "test2": "MXB52FNG4I",
            "test3": "EGZ43XVV1GX",
            "test4": "Pharetra Quisque Ac LLC"
        },
        {
            "test1": 79,
            "test2": "NWE27YBV2Q",
            "test3": "AAB74SUQ5EE",
            "test4": "Ac Fermentum Vel Inc."
        },
        {
            "test1": 80,
            "test2": "DUI95FAD1R",
            "test3": "SFV42OIV8IC",
            "test4": "Suspendisse Foundation"
        },
        {
            "test1": 81,
            "test2": "QDL94IFT0V",
            "test3": "ACH24YQH4NI",
            "test4": "In Institute"
        },
        {
            "test1": 82,
            "test2": "MTZ80YPK4H",
            "test3": "CLR27TDV1YC",
            "test4": "Pede Ltd"
        },
        {
            "test1": 83,
            "test2": "IUZ96ADX7R",
            "test3": "CJK10VNQ8RQ",
            "test4": "Ligula Nullam Feugiat Company"
        },
        {
            "test1": 84,
            "test2": "TQU09MUY9P",
            "test3": "RAH26QXB5RY",
            "test4": "Congue Elit Associates"
        },
        {
            "test1": 85,
            "test2": "VQV87HRG4S",
            "test3": "EAM74CVK2JV",
            "test4": "Nec Cursus LLC"
        },
        {
            "test1": 86,
            "test2": "MJI37VEU2W",
            "test3": "YKF18NVO5OJ",
            "test4": "Facilisis Corporation"
        },
        {
            "test1": 87,
            "test2": "LCL54EPK5Q",
            "test3": "VYR25WLK9CW",
            "test4": "Sapien Inc."
        },
        {
            "test1": 88,
            "test2": "JCK82BXW1Z",
            "test3": "VKA71SMZ3IY",
            "test4": "Lorem Incorporated"
        },
        {
            "test1": 89,
            "test2": "GJE01OMX0N",
            "test3": "ZGL89SMQ4KR",
            "test4": "Vehicula Consulting"
        },
        {
            "test1": 90,
            "test2": "VDF11HYI6G",
            "test3": "LHQ97XHE4FN",
            "test4": "Sed LLC"
        },
        {
            "test1": 91,
            "test2": "LKL90EDU2A",
            "test3": "HLH53XTJ2BQ",
            "test4": "Malesuada Id Erat LLC"
        },
        {
            "test1": 92,
            "test2": "WFR23JBY5Y",
            "test3": "CPY75MGD3JL",
            "test4": "Tincidunt Incorporated"
        },
        {
            "test1": 93,
            "test2": "VWF39SIN0Y",
            "test3": "TIO35CDK6LY",
            "test4": "Nunc Ullamcorper Velit Institute"
        },
        {
            "test1": 94,
            "test2": "KND09FCY7U",
            "test3": "QLA57VXX6FA",
            "test4": "Duis Elementum Dui Corporation"
        },
        {
            "test1": 95,
            "test2": "BWT30YEK6F",
            "test3": "NFN28YTY6QK",
            "test4": "Donec Foundation"
        },
        {
            "test1": 96,
            "test2": "GBG84YWD3R",
            "test3": "NLU61VCT8NS",
            "test4": "Donec Vitae Erat Ltd"
        },
        {
            "test1": 98,
            "test2": "FUX96SLL9Q",
            "test3": "AMT00UEH1GA",
            "test4": "Velit Eu Corporation"
        },
        {
            "test1": 99,
            "test2": "IES08IXQ6Q",
            "test3": "GHU93PTV0DW",
            "test4": "Placerat Cras Foundation"
        },
        {
            "test1": 101,
            "test2": "VPD98CZE8K",
            "test3": "YJB83FPP6PK",
            "test4": "Ultricies PC"
        },
        {
            "test1": 102,
            "test2": "TCI68JYI2X",
            "test3": "PKY99XRT1CM",
            "test4": "Urna Institute"
        },
        {
            "test1": 103,
            "test2": "XPH88NZC5U",
            "test3": "XCD49BTQ9EH",
            "test4": "Dolor Dolor Tempus Consulting"
        },
        {
            "test1": 104,
            "test2": "ZST86MIT5O",
            "test3": "VYK18TQC0QU",
            "test4": "Interdum Institute"
        },
        {
            "test1": 105,
            "test2": "BYP49GEP5Y",
            "test3": "EZI92MOU2TJ",
            "test4": "Iaculis Aliquet Diam Institute"
        },
        {
            "test1": 106,
            "test2": "KNB59YFO5I",
            "test3": "GYC82AYZ1CH",
            "test4": "Magnis Dis Foundation"
        },
        {
            "test1": 107,
            "test2": "FGH99YPE9B",
            "test3": "DQK42PYI6BT",
            "test4": "Auctor Vitae Corp."
        },
        {
            "test1": 108,
            "test2": "ZHQ77AHV8Y",
            "test3": "BGE24YXU5FB",
            "test4": "Morbi Tristique Corp."
        },
        {
            "test1": 109,
            "test2": "JBV00EVU6O",
            "test3": "RVK21WPU7MR",
            "test4": "Varius LLC"
        },
        {
            "test1": 110,
            "test2": "BSR87RLD0A",
            "test3": "BDF88TNO4OB",
            "test4": "Sed Associates"
        },
        {
            "test1": 111,
            "test2": "MWO34LZT1H",
            "test3": "VVW11LVD6JV",
            "test4": "Massa Consulting"
        },
        {
            "test1": 112,
            "test2": "IYJ51OSV4M",
            "test3": "ANO88XZN5BO",
            "test4": "Donec Ltd"
        },
        {
            "test1": 113,
            "test2": "PNJ93PJP4W",
            "test3": "LDX97BEK9IZ",
            "test4": "Fusce Fermentum Associates"
        },
        {
            "test1": 114,
            "test2": "KVQ06ABA2I",
            "test3": "SSW34BIK6NZ",
            "test4": "Ut Pharetra Ltd"
        },
        {
            "test1": 115,
            "test2": "UFG20VHQ9E",
            "test3": "TLY32NOU1LL",
            "test4": "Turpis Limited"
        },
        {
            "test1": 116,
            "test2": "TDY37HOZ9C",
            "test3": "AYV74CIT4BA",
            "test4": "Eu LLP"
        },
        {
            "test1": 117,
            "test2": "WYR63KNO6S",
            "test3": "EXE56PTG3JP",
            "test4": "Parturient Montes Incorporated"
        },
        {
            "test1": 118,
            "test2": "VRV80FPD7Y",
            "test3": "WAC70EXA2MN",
            "test4": "Feugiat Sed Nec Company"
        },
        {
            "test1": 119,
            "test2": "LEF59IMD2P",
            "test3": "YRQ09CJY9ZY",
            "test4": "Ullamcorper Magna Sed Industries"
        },
        {
            "test1": 120,
            "test2": "ESS71ESO4I",
            "test3": "KTA37IMT9QK",
            "test4": "Tincidunt Corp."
        },
        {
            "test1": 121,
            "test2": "DLV06YLC5A",
            "test3": "ODD26GMI8VO",
            "test4": "Nulla Facilisi Limited"
        },
        {
            "test1": 122,
            "test2": "FXX67CEV2C",
            "test3": "IEO73ILX6ZD",
            "test4": "Donec Incorporated"
        },
        {
            "test1": 123,
            "test2": "JUR80SJB2O",
            "test3": "UFA85BUP9VE",
            "test4": "In Molestie Company"
        },
        {
            "test1": 124,
            "test2": "IHN55ZJR5D",
            "test3": "KEY15UIY2WQ",
            "test4": "Nibh Company"
        },
        {
            "test1": 125,
            "test2": "NSP50EEK1Y",
            "test3": "UFG47QDC2SD",
            "test4": "Sit Amet Risus Associates"
        },
        {
            "test1": 127,
            "test2": "OCT07YTI8J",
            "test3": "RGJ49MFH8JB",
            "test4": "Consequat Corporatiosq"
        },
        {
            "test1": 138,
            "test2": "cururu",
            "test3": "2c124dw",
            "test4": "samsung"
        }
    ]
}

я пытался

разобрать json информацию

получить некоторую информацию ps: извините за май низкокачественный английский

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...