Im having issues getting my data passed back to an external variable. I know the ajax request works but its not passing it in the manner that i need.
here is a exact method in my class
function(amount,symbol=''){
   var current_rate = '';
   var url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D'https%3A%2F%2Fwww.google.com%2Ffinance%2Fconverter%3Fa%3D"+ amount +"%26from%3DNGN%26to%3D"+ symbol +"'%20and%20xpath%3D'%2F%2Fdiv%5B%40id%5D'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
   
   var get_rate = $.ajax({
     url: url,
     method: "GET"
   }).complete(function(data){
    current_rate = data.responseJSON.query.results.div.span.content;
   }).fail(function( jqXHR, textStatus ) {
    alert( "Request failed: " + textStatus );
   });
  
   return current_rate;
  }Ive edited the code for simplicity. but heres the full script . I just need to know how to pass the data from the request back into the 'Current_rate' variable
 
     
    