I'm working on a web application, in which the values of an array is pushed through a JavaScript function call of one HTML page, and the same array needs to be accessed from another JavaScript function called by a different HTML page.
The code at the moment is:
var global_array = [];
function pushIntoArray(){
global_array.push({"id":1, "value":"example1"}, {"id":2, "value":"example2"});
}
function getArrayValues(){
console.log(global_array);
}
The first function is called through a button click, the second function is called on a different page on page load.
The problem I'm having is that when the second function getArrayValues() is called on a different HTML page, the values that were previously pushed into the array "global_array" disappears.
What is the most efficient way solve this? Thanks.