Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

datatables typeerror k is undefined

 $('#table1').DataTable({
            "ajax": {
                "url": "http://localhost:3000/mydata",
                "type": "GET",
                "dataSrc": "mydata", // add this to your ajax mehtod see example
                "columns": [{
                        data: "MyID"
                    },
                    {
                        data: "MyType"
                    }
                ]
            }
        });

//Example: Json response from api call
[
  mydata:[
		  {},
   		  {}
		]
]
//Data Table
ajax: {
  url:"/dummyData.txt",
  "dataSrc":'' // if data source is empty
},


//Example: empty data response from api call
[
  {},{}
]
 
PREVIOUS NEXT
Tagged: #datatables #typeerror #undefined
ADD COMMENT
Topic
Name
8+3 =