I have a jquery ajax function with a callback. This callback creates an array from a json that is retrieved from the function. So I have
success: function (response) {
callback(response);
},
and the callback creates the array with the call:
Questions(8,createQuestionsArray);
function createQuestionsArray(result){
for(var subject in result){
var size =Object.keys(result[subject]).length;
for(var i=0;i<size;i++){
questions[i] = result[subject][i];
}
}
}
I would like to load this array on the begining of the application so when the user start the quiz I don't need to load the questions. How can I store it? Because just putting in a global questions variable, when I go to another page I have an empty object.
Thanks.