Stuck in Jquery with I think something quite simple but I don't understand why it does not work.
I have a $.post that retrieves a value from an asp file and puts it into a variable in my main page.
var bankmsgstatus;
$.post("bankmsgstatus.asp", {}, function(data3) {
bankmsgstatus = data3;
});
However, when I try to do a if comparison, it does not work.
if (bankmsgstatus == 'on') {
alert("Value: " + bankmsgstatus);
} else {
alert("Value: " + bankmsgstatus);
}
All I get is that the bankmsgstatus value is 'undefined'
What am I doing wrong?
Thanks