I have this code and i realize that i cant have access outside from ajax except I globalize the data variable. Eg
$.ajax({
url: 'includes/ajax_chart.php',
data:{present:'present'},
type: 'POST',
dataType: 'JSON',
success: function (data) {
if (!data.error) {
b = data;
}
}
});
So we must work with global variables and data or there is another way to keep these variables inside the function that contains Ajax?