Javascript anonymous function not updating global variable
问题 I've got a $.getJSON call in some code that appear to be not updating a global variable, and I'm at a loss to understand why. The JSON data is being loaded OK, but for some reason the global EventOptions array is not being updated in the for {} loop. The capitalised comments refer to the variable. Any ideas? Thanks function LoadMeasurementTypes() { // Clear out EventOptions EventOptions = ["..."]; // Push a couple on to EventOptions - THESE ADD OK EventOptions.push("Temperature");