Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Google Sheets API未在PhoneGap应用程序中返回结果_Javascript_Api_Cordova_Google Sheets Api_Phonegap - Fatal编程技术网

Javascript Google Sheets API未在PhoneGap应用程序中返回结果

Javascript Google Sheets API未在PhoneGap应用程序中返回结果,javascript,api,cordova,google-sheets-api,phonegap,Javascript,Api,Cordova,Google Sheets Api,Phonegap,我有一个网页,我想变成一个phonegap应用程序 它可以在网站上正常工作,运行于localhost:3002,从谷歌表单中获取数据。但它不适用于PhoneGap CLI提供的IP地址(以及android上的PhoneGap开发者应用程序),即192.168.1.43:3002 在192.168.1.43:3002上运行时,它会在控制台中记录以下错误: GET https://accounts.google.com/o/oauth2/iframerpc?action=listSessions&a

我有一个网页,我想变成一个phonegap应用程序

它可以在网站上正常工作,运行于
localhost:3002
,从谷歌表单中获取数据。但它不适用于PhoneGap CLI提供的IP地址(以及android上的PhoneGap开发者应用程序),即
192.168.1.43:3002

192.168.1.43:3002上运行时,它会在控制台中记录以下错误:

GET https://accounts.google.com/o/oauth2/iframerpc?action=listSessions&scope=op…n=http%3A%2F%2F192.168.1.43%3A3002&origin=http%3A%2F%2F192.168.1.43%3A3002 400 ()
我已经在Google开发者控制台的授权JavaScript源代码下添加了IP地址和localhost:3002

HTML文件:

  ...
  <script type="text/javascript" src="cordova.js"></script>

  <script async defer
  src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxx&libraries=geometry">
  </script>

  <script src="https://apis.google.com/js/api.js"></script>
  ...

是什么导致它在
localhost
上工作,而不是在IP地址上工作(也是PhoneGap开发者应用程序)?

可能它没有被列入白名单?@webbanditen很好,这表明它是白名单。我还能怎么查呢?有什么建议吗?我也没能让它起作用。我正在讨论使用AJAX是否有效。也许它没有被列入白名单?@Webbanditen——这表明它是有效的。我还能怎么查呢?有什么建议吗?我也没能让它起作用。我正在讨论如何使用AJAX,看看这是否有效。
  ...

  function start() {
    var sheetId = 'xxxxxxxxx';

    // 2. Initialize the JavaScript client library.
    gapi.client.init({

      'apiKey': googleApiKey,

      'clientId': 'xxxxxx-xxxxxxxxxxxxxx.apps.googleusercontent.com',
      'scope': 'https://www.googleapis.com/auth/spreadsheets.readonly'

    }).then(function() {

      // 3. Initialize and make the API request.
      return gapi.client.request({
        'path': 'https://sheets.googleapis.com/v4/spreadsheets/'+sheetId+'/values/A:F'
      });

    }).then(function(response) {

      console.log(response);

      createplacesList(response.result.values);

    }, function(reason) {

      console.log('Error: ' + reason.result);

    });
  }

  // 1. Load the JavaScript client library.
  gapi.load('client', start);

  ...