I am a javascript/jquery noob, and am going crazy as to why I cannot get the values I receive in a jquery function to also be available outside of that function. Here's what I have inside a Javascript function:
lines=[];
$(document).ready(function(){
$.get("sampledata.txt", function(dataInput, status){
lines = dataInput.split(",");
alert("Lines inside: " + lines); //Prints out fine here
});
});
alert("Lines outside: " + lines);
The alert "Lines outside" returns blank, but "Lines inside" returns my list of ten numbers, comma separated. I tried to declare lines outside of the jquery function, but it seems that it's ignoring the changes made inside the jquery function. Everything works as I would like inside the jquery function.
sampledata.txt looks like this:
10,20,30,40,50,60,70,80,90,100