我如何在请求中返回函数?

时间:2018-10-25 19:00:51

标签: javascript

假设我有这种情况...

function b()
{ 
   var nameofafile;
   var rtr=a(nameofafile);
   console.log(rtr); //The path should come here, but returns undefined 
}

function a(nameofafile)
{
     gapi   //....blablabla

     request.execute(function(resp){

     //severalthingsdone

    console.log(path) 

     return path; //Here i want to do the  return to "function a" the path  of a file in the Drive that i'm already logging correctly
     });
}

该请求负责返回命令的“功能a”的可见性受损? 我该如何绕路呢?

0 个答案:

没有答案