I am not understanding the data structures.

I am not understanding the data structures.

classic12classic12 Posts: 228Questions: 60Answers: 4

I am bringing back some data from an Ajax call.

req = Ajax("http://xxx.com.myphp", "GET", 'someData',quotesReturned);
When I output it to the console I get the array and use it as follows.

var dataSet =  [["566","1318","2017-11-08","http:\/\/www.toolfolks.com\/techy\/quoteImages\/566_1.jpg",null,"Job lot Zandra Rhodes bags. ",null,"D","Live","1600.00","0.00","1600.00"],["565","1318","2017-11-02","http:\/\/www.toolfolks.com\/techy\/quoteImages\/565_1.jpg",null,"15000 x desperado bar runners \u00a35000 cash take all 11 x pallets\n",null,"D","Live","0.00","0.00","0.00"],["564","1318","2017-11-02","http:\/\/www.toolfolks.com\/techy\/quoteImages\/564_1.jpg",null,"Job Lot Tridonic parts. ",null,"D","Live","6000.00","0.00","6000.00"],["563","1015","2017-11-02","http:\/\/www.toolfolks.com\/techy\/quoteImages\/563_1.jpg",null,"Duracell Torches with batteries. Job Lot or quantities available.",null,"D","Live","14000.00","0.00","14000.00"],["562","1015","2017-11-02","http:\/\/www.toolfolks.com\/techy\/quoteImages\/562_1.jpg",null,"Dell Ultrasharp 17\" Monitors. Grade A. Individually shrink wrapped.",null,"D","Live","2220.00","0.00","2220.00"],["561","1318","2017-11-02","http:\/\/www.toolfolks.com\/techy\/quoteImages\/561_1.jpg",null,"https:\/\/www.amazon.co.uk\/Tactus-Pique-Camera-Headset-Viewer\/dp\/B0749LZ6KZ\n \n900 units @ \u00a337each.",null,"D","Live","0.00","0.00","0.00"],["560","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/560_1.jpg",null,"LG\/Sony Phone Adaptors 500. each \u00a33.00 each. (No VAT Bill of Sale)\n\nTake all deal.",null,"D","Live","0.00","0.00","0.00"],["559","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/559_1.jpg",null,"APPLE\/SAMSUNG CHARGERS We have available now 500 units @ \u00a33.75 each. (no VAT with Bill of Sale)\n\nTake all deal.\n",null,"D","Live","0.00","0.00","0.00"],["558","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/558_1.jpg",null,"I have 29 New open box Fujitsu windows tablets complete with the cradle.\n",null,"D","Live","4350.00","0.00","4350.00"],["557","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/557_1.jpg",null,"This is at the Staples distribution centre in the Midlands as you can see we got a third of the way down at the retail game to approx. 659k. (probably over a million retail) It is packing material box",null,"D","Live","0.00","0.00","0.00"],["556","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/556_1.jpg",null,"3200 x Hoover Syrene Cordless Stick Vacuum cleaner brand new\u2026.. \u00a331.00 each ONO.",null,"D","Live","99200.00","0.00","99200.00"],["555","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/555_1.jpg",null,"Available now 6500 units, 46 pallets SONNETT childrens jackets.\nBe aware VAT is not charged on childrens clothes.",null,"D","Live","39000.00","0.00","39000.00"],["554","1318","2017-10-30","http:\/\/www.toolfolks.com\/techy\/quoteImages\/554_1.jpg",null,"41 ( 20\" 19 \" & 17\" ) Two Pallets Openend boxed HP Monitors. Manufacturer\u2019s warranty.\n\u00a32500 for the parcel. Collection from Manchester. ",null,"D","Live","2500.00","0.00","2500.00"],["553","1318","2017-10-20","http:\/\/www.toolfolks.com\/techy\/quoteImages\/553_1.jpg",null,"Belkin Gear. Take all offer please. All New.",null,"D","Live","0.00","0.00","0.00"],["550","1333","2017-10-19","http:\/\/www.toolfolks.com\/techy\/quoteImages\/550_1.jpg",null,"364 Pirate Lab Cases New Take all. \n<a href=\"http:\/\/www.toolfolks.com\/techy\/quoteImages\/550.xlsx\"style=\" color: white\" target=\"_blank\">Click for details!<\/a>",null,"D","Live","3000.00","0.00","3000.00"],["549","1323","2017-10-19","http:\/\/www.toolfolks.com\/techy\/quoteImages\/549_1.jpg",null,"923 X new HP Keyboards Various languages <a href=\"http:\/\/www.toolfolks.com\/techy\/quoteImages\/549.xlsx\"  target=\"_blank\" style=\"color:white\u201d>Click for details!<\/a>",null,"D","Live","3000.00","0.00","3000.00"],["548","1323","2017-10-19","http:\/\/www.toolfolks.com\/techy\/quoteImages\/548_1.jpg",null,"350 x new Model: IPP350-01T1214  Chip & Pin machines ( take all deal )",null,"D","Live","3850.00","0.00","3850.00"],["547","1323","2017-10-19","http:\/\/www.toolfolks.com\/techy\/quoteImages\/547_1.jpg",null,"2220 Dymo Labels Brand New ( Take all Deal ). Fits the Dymo XTL 300 & 500 range.\n<a href=\"http:\/\/www.toolbank.com\/0\/p\/DYM1868757\"style=\" color: white\" target=\"_blank\">Click for details!<\/a>\n\n","RS part numbers 8931725  8931570  8931586","D","Live","17760.00","0.00","17760.00"],["546","669","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/546_1.jpg",null,"120 * Toshiba 500gb 2.5\u201d Sata Drives Model MQ01ACF050",null,"D","Sold","0.00","0.00","0.00"],["545","1333","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/545_1.jpg",null,"238 x Otone Varsa 2.0 Multimedia Speaker \/ Mini Soundbar Amazon \u00a379.99 ( Take all ) \n<a href=\"https:\/\/www.amazon.co.uk\/OTONE-Audio-Varsa-soundbar-speakers\/dp\/B007L02SJS\" target=\"_blank\" style=\" color",null,"D","Live","4284.00","0.00","4284.00"],["544","669","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/544_1.jpg",null,"1718 Cat 5 & 99 Cat6 cables New.",null,"D","Live","0.00","0.00","0.00"],["543","1318","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/543_1.jpg",null,"180 X 49cc Quad bikes.Stock in the UK ",null,"D","Live","0.00","0.00","0.00"],["542","1318","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/542_1.jpg",null,"Any interest in bidding on 628 x Grade A Samsung Galaxy tabs as per below spec? \u00a350 bid already rejected.",null,"D","Live","0.00","0.00","0.00"],["541","1318","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/541_1.jpg",null,"500 EPSON receipt  printers. ( Take All );",null,"D","Live","62500.00","0.00","62500.00"],["540","1318","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/540_1.jpg",null,"51786 Venos Tickly Coughs UK stock Best Before Nov 2019 (VAT exempt)\nOverstock this product must be sold outside of the UK.",null,"D","Live","51786.00","0.00","51786.00"],["539","1318","2017-10-18","http:\/\/www.toolfolks.com\/techy\/quoteImages\/539_1.jpg",null,"1800 DIABLO Ipad Mini Cases  Take all deal.",null,"D","Live","3240.00","0.00","3240.00"]];

this works okay.

  tableObject  =  $('#dtQuotes').DataTable( {
        data: dataSet,
            
 columns: [
            { title: "Name" },
            { title: "Position" },
            { title: "Office" },
            { title: "Extn." },
            { title: "Start date" },
            { title: "Salary" }
]


} );

If I use dataSet = req.responseText; ie the returned data directly I get the error

DataTables warning: table id=dtQuotes - Requested unknown parameter '1' for row 0, column 1. For more information about this error, please see http://datatables.net/tn/4

Is there a structure difference between the data I get back and when it is outputted to the console. ?

Cheers

Steve Warby

This discussion has been closed.