I am a newbie in JS and I am trying to do something very simple.
I have a JSON file named "data.json" and I want to load it, so, I do this:
$.getJSON("data.json",function(data){
console.log(data);
});
And then I pass that loaded JSON to a function in library that does this:
$("#example1").handsontable({
data:data, //<--- error here
minRows: 2,
minCols: 3,
minSpareRows: 1,
currentRowClassName: 'currentRow',
currentColClassName: 'currentCol',
autoWrapRow: true,
colHeaders: true
});
$("#example1").handsontable('selectCell', 3, 3);
Firebug says
ReferenceError: data is not defined
[Break On This Error]
data:data,
I thought I already loaded the JSON into the data variable? Any suggestions?
data:data? Remove it and I think it will work.getJSONrequest.