I have to populate a JavaScript array using ASP. Now, this shouldn’t be difficult, but because of the way I needed to lay out the page, the array cannot become filled until the end of the page, but the array need to be declared in the beginning. Therefore, I thought that filling the array using a function would suffice since the function can be implemented later on the page. Here is what I have so far:
[code=php]/* fill variables */
var arrDrivers = new Array();
call popDrivers(arrDrivers);
var arrTrucks = new Array();
call popTrucks(arrTrucks);
Later in the page, I hae the functions laid out like so…
[code=php]function popDrivers(arrDrivers){
//The ASP outputs numerous lines like this…
arrDrivers[“6279″]=”John B. Doe”;
return arrDrivers();
}
Now, what am I doing wrong in trying to fill the arrays?