Okay guys,
I need some help with this jQuery dilemma:
I have 3 arrays declared globally in the header of my website:
var array1 = [];
var array2 = [];
var array3 = [];
I have a function like this:
function setDropDownList(raw_id){
jQuery.each(mytest, function(key, value) {
var mytest = value.split('|');
}
}
Instead of "mytest" I need to dynamically load each of the 3 arrays declared globally above.
How can I do it?
I'm thinking of something lime this:
function setDropDownList(raw_id, "??? how can I generate which array I need: array1 or 2 or 3?"){
jQuery.each(the_needed_array, function(key, value) {
var the_needed_array = value.split('|');
}
}
In PHP, there is something called variable variables, and I could have something like this.
var array_name = 'array1';
And in the function:
$$array_name;