I would like to retrieve data from a session variable on a button click, without reloading the page. My getter function is the following one:
function GetSession()
{
var value;
function GetValue(data)
{
value = data;
}
$.get("sessionAPI.php?action=get", function(data) { GetValue(data); });
return value;
}
Yet the "value" variable stays undefined after I call this function. How could I give the value of "data" to the "value" variable? Thanks for the answers!