I would like to not have to declare a lot of different arrays to access different values, like I did in my code.
What should I change in the function structure to have something like an array of arrays, or something else that will allow me to access it like ipOpts[array], example: ipOpts[0], ipOpts[1].
So I will just have to declare it once.
JS Function:
var ipOpts0 = new Array({"label" : "a", "value" : "a"});
var ipOpts1 = new Array({"label" : "a", "value" : "a"});
var ipOpts2 = new Array({"label" : "a", "value" : "a"});
var ipOpts3 = new Array({"label" : "a", "value" : "a"});
var ipOpts4 = new Array({"label" : "a", "value" : "a"});
var ipOpts5 = new Array({"label" : "a", "value" : "a"});
var ipOpts6 = new Array({"label" : "a", "value" : "a"});
function ipOpts(myField,myArray){
    myArray.splice(0,1);
    $.ajax({
      url: './php/selectBox.php?myField='+myField,
      async: false,
      dataType: 'json',
      success: function (json) {
          for(var a=0;a<json.length;a++){
            obj= { "label" : json[a][0], "value" : json[a][1]};
            myArray.push(obj);
          }
        }
    });
    return myArray;
}
 
    