var myXML;
$.ajax({
type:'GET',
url:'http://localhost:8080/someCGIhere/',
datatype:'xml',
success: function(xml){
console.log('Success!');
myXML = $(xml).find('SomeThing').text();
//1) Prints out the myXML value
console.log("myXML = " +myXML);
}
});
//2) Prints out undefined
console.log('Result = '+myXML);
How come the response is not stored outside of success scope, considering it is assigning the value to a variable declared outside of its scope?