i have below code, here i need to get time variable from getTime?
    function getTime(handleData) {
            return $.ajax({
          url: 'data',
        success:function(data) {
           handleData(data); 
              }
            });
           }
   getTime(function(output){
     if(output == null || output == undefined)
     console.log("data is null");
     arr1 = output.split('\n');
       var time= arr1[0];
      return time
      });
If i try to get time value as below its giving undefined
 var time =getTime(function(output){
 if(output == null || output == undefined)
 console.log("data is null");
 arr1 = output.split('\n');
   var time= arr1[0];
  return time
  });
 
    