jquery - Getting undefined response from ajax call -


this question has answer here:

i having issues getting results returned through ajax call. console.log(data) returning [undefined] on ajax call:

$.get(root+'hoteles/functions/ean/get-zones.php', { zo: zones_arr }, function(data){       return data;       },'json'); 

the response file returning correctly , json encoded including header tag.

after trying googled, thought possibly response not done loading. added addition , worked charm! similar issue of complete , success on $.ajax call.

i added .done() after function returned data, , did meant do!

$.get(root+'hoteles/functions/ean/get-zones.php',{ zo: zones_arr }, function(data){     },'json').done(function(data){          console.log('it worked!');          console.log(data);          return data;    });  

if has better solution please post others can figure out too!


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -