Here’s my jQuery function,
$.post("assets/scripts/chat/get_user_info.php", {UserID: UserID}, function(data){
if (data == "error") {
alertBar('negative','There was an error sending the message');
}
var username = data;
})
But I only use the “data” or “username” variable in the function itself, so how can I use it globally around the whole page?
Define variable in the global scope, outside your function.
var username, data;$.post("assets/scripts . . .