Let's say I have this variable named nom that has a value of lol.
var nom = "lol";
Then I have this ajax function, if the data is false, I want to override the value of nom to whay, assuming the data is false.
$.ajax({ type: "POST", url: "micro/wave.php",
data: { username: "some string" },
success: function(data) {
if (data == false) {
nom = "whay";
}
}
});
Then if I alert the variable nom, it still alerts lol, it should alert whay because the data is false.
alert(nom);
Any solution for this stuff?