I implemented a auto-complete function that takes an array as parameter.
$(document).ready(function(){
$('#empf').autocomplete(['black', 'white', 'red']);
}
Now I do not want a static array. Outside the document ready function I declared a function that retrieves the colors from local storage. I call this function in document ready function.
So everytime the user enters new input I want to put it in the array and use that array globally. Is that possible?
For initialisation of the array, at any point I know the number of colores stored.
So instead of the static array I put a variable e.g. data and I declare data as an array. I tried it this way:
var colors;
$(document).ready(function(){
loadColors();
$('#empf').autocomplete(colors);
}
function loadColors(){
colors = new Array(getNumColor()));
//in a loop save the colors to array using colors[i] = ...
}
But this causes my application to crash. Any ideas?
Any ideas?