my code in a javascript file:
$.getJSON('assets/jsons/fields.json', function(fieldsData){
fieldsdata = fieldsData;
});
$.getJSON('assets/jsons/rulesjs.json', function(rulesData){
rules = rulesData;
});
conditions.conditionsBuilder({
fields: fieldsdata,
data: rules
});
with a breakpoint at fields:fieldsdata, it works fine. It fetches data from the respective .json file and shows data Else it doesn't show any thing. Things I have tried: 1. I tried rearranging the javascript file declaration in index.html. No success 2. I tried using global variables. 3. I tried putting GETJSON's in a different function and call it before assignment.
I know I am missing something simple but could not figure out. Plz help. Thanks