jquery - Getting undefined response from ajax call -
this question has answer here:
- how return response asynchronous call? 24 answers
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
Post a Comment