$.post() success function problem
Hi everyone!
I can't use the value returned by $.post() method out of the scope of success function.
For instance in below example myvar alerted as empty even though var is alerted with a value. Besides, hide does not work in the scope of success function.
I appreciate any help/workaround.
Thanks..
var myvar = "";
$.post("somepage.php", {first: "1", second: "2"}, function(val){
alert(var);
myvar = var;
this.hide('slow');
});
alert(myvar);