Declare global variables(jquery):
$.mynamespace = { myVar : "something" };
I will do some operations with xml, after that will assign some other value to myVar and call to function test() will again change the value of myVar. Then I want the value of var must be same as I changed in test() function.
$(document).ready(function(){
//Some XML oprations
$.get("students.xml",{},function(xml){
$.mynamespace.myVar="ewewewewewew";
test();
});
//value of $.mynamespace.myVar must be test
alert($.mynamespace.myVar);
});
function test(){
alert($.mynamespace.myVar );
$.mynamespace.myVar="test";
}