I have three pages utilizing the same code and on one of the pages this variable doesn't exist, on the other two the variable ticketType has a value of 1 or 2. I need to first check if ticketType exists and isn't undefined and secondly, need to determine if it's one or 2.
This if statement generates an error:
if(typeof ticketType != undefined && ticketType == 1){}
It's saying ticketType isn't defined
. I tried nesting the if statements to check if it was defined first thinking it wouldn't go and try the inner if statement but firebug still generates an error.
Any ideas? There has to be a way to do this...