Hi, I have a javascript function as follows:
function StateSuggestions() { this.states =[]; $j.getJSON("client/ajax/getMedList.php", function(data){ alert("inside getJSON" + data.length); this.states = data; alert(this.states.length); //Value says 10 for (i = 0; i < data.length; i++) { alert("test" + i); } }); alert(this.states.length); // Length here is 0 } I want to populate the this.states array with data being retrieved by the getJSON call...however it appears that the value of this.states is different depending on whether or not you are inside the JSON call or outside of it...not sure why... M