Im trying to fetch data from ajax using handsontable cell type:
data: ‘Cost_Code’,
type: ‘handsontable’,
handsontable: {
colHeaders: [‘CostCodeID’],
autoColumnSize: true,
data: getCostCode
},
strict: true
im calling the function getCostCode to populate the data
function getCostCode(query){
$.ajax({
url: 'offon.asmx/getCost_Code?query=' + query,
dataType: 'json',
type: 'GET',
success: function (response) {
console.log(response);
return (response); // JSON.parse takes string as a argument
//return JSON.parse(response); tried this and getting the same error.
}
});
and the ajax data is:
[{“Cost_Code”:“01-001”},{“Cost_Code”:“01-00101”},{“Cost_Code”:“01-00155”},{“Cost_Code”:“33-331”},{“Cost_Code”:“33-33112”},{“Cost_Code”:“10-110”},{“Cost_Code”:“10-11010”},{“Cost_Code”:“10-430”},{“Cost_Code”:“10-43000”},{“Cost_Code”:“01-100”},{“Cost_Code”:“10-11001”},{“Cost_Code”:“10-11002”},{“Cost_Code”:“44-123”},{“Cost_Code”:“44-12312”},{“Cost_Code”:“11-100”},{“Cost_Code”:“11-10001”},{“Cost_Code”:“55-123”},{“Cost_Code”:“55-124”},{“Cost_Code”:“55-125”},{“Cost_Code”:“55-126”},{“Cost_Code”:“10-100”},{“Cost_Code”:“10-110”},{“Cost_Code”:“20-100”},{“Cost_Code”:“10-100”},{“Cost_Code”:“20-100”},{“Cost_Code”:“12-253”},{“Cost_Code”:“10-123”},{“Cost_Code”:“10-12345”},{“Cost_Code”:“10-10010”},{“Cost_Code”:“10-16055”},{“Cost_Code”:“10-16054”},{“Cost_Code”:“10-100”},{“Cost_Code”:“10-10012”},{“Cost_Code”:“01-55891”},{“Cost_Code”:“12-54123”},{“Cost_Code”:“10-56412”},{“Cost_Code”:“01-66678”},{“Cost_Code”:“10-33542”},{“Cost_Code”:“X1-12345”},{“Cost_Code”:“51-678”},{“Cost_Code”:“52-111”},{“Cost_Code”:“52-11211”},{“Cost_Code”:“10-119”},{“Cost_Code”:“XX-234”},{“Cost_Code”:“XX-XXX”},{“Cost_Code”:“XX-XX123”},{“Cost_Code”:“SS-SSS”},{“Cost_Code”:“SS-SSS01”},{“Cost_Code”:“12-231”},{“Cost_Code”:“12-24412”},{“Cost_Code”:“12-24442”},{“Cost_Code”:“01-00-00”},{“Cost_Code”:“01-01-00”},{“Cost_Code”:“01-01-01”},{“Cost_Code”:“02-00-00”},{“Cost_Code”:“02-01-00”},{“Cost_Code”:“02-01-04”},{“Cost_Code”:“02-01-05”},{“Cost_Code”:“02-05-00”},{“Cost_Code”:“02-05-02”},{“Cost_Code”:“03-00-00”},{“Cost_Code”:“03-03-00”},{“Cost_Code”:“03-03-01”},{“Cost_Code”:“10-002”},{“Cost_Code”:“01-001”},{“Cost_Code”:“01-45856”},{“Cost_Code”:“01-002”},{“Cost_Code”:“01-75896”},{“Cost_Code”:“01-003”},{“Cost_Code”:“01-01-01”}]
the problem:
handsontable.full.min.js:34 Uncaught Error: loadData only accepts array of objects or array of arrays (function given)
what am i missing?