I have a page for an online store that contains 3 different items that can be bought in 3 different colors and 2 different sizes. I am using PayPal which gave me 10-character ids for each item, though I also use another nomenclature to distinguish between them. I use the first letter of the item, the first letter of the color (luckily there are no duplicates like blue and black) then the size using _ where / would be. This forms a string such as bb1_8 or tw1_4. I have created an associative array using these strings for the keys and the 10-character IDs as the values. So I have the following:
var hookID = new Array();
hookID["bb1_8"] = "LSADAMANTMZU8";
hookID["tw1_4"] = "RD3D42AK8EPDN";
hookID["bb1_4"] = "T94QFP82RW78J";
The problem I'm having is when I try to get the ID value out of the array. When I use:
I don't get anything. Instead, an error occurs saying "Unable to get property 'bb1_8' of undefined or null reference". I don't understand why I can't get the values out. Obviously, I wouldn't use a hard-coded id, but if I can't get even a hard-coded one, how will I get one that is variable?