0

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?

jean-max
  • 1,640
  • 1
  • 18
  • 33
liontass
  • 730
  • 9
  • 24

0 Answers0