简体   繁体   中英

XMLHTTPRequest is not defined? Google Spreadsheets?

I'm fairly new to Ajax and was working on some scripts in Google Spreadsheets and was given the error: "ReferenceError: "XMLHttpRequest" is not defined. (line 21, file "getBookmarks")". Is there a problem with my code or is it that certain functions are limited when making a XMLHtppRequest in Google Spreadsheets to an external source?... I checked and all the other functions I used were fine?

function getBookmarks() {
   //Opening Active Spreadsheet
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var sheet = ss.getSheets()[0];

    // Get the range of cells that stores event data.
    var eventDataRange = ss.getRangeByName("Url");

    // Stores URL into eventObject
    var eventObject = getRowsData(sheet, eventDataRange);

     for (var i=0; i < countProperties(eventObject); i++)
    {

     //Making the Ajax Call

      var xmlhttp;
      xmlhttp=new XMLHttpRequest();
      xmlhttp.open("GET",eventObject[i],true);
    }
   //search for string ""global-bookmark-count" class="count-text">"
   //get bookmark number bookmark
   //return bookmark //returning bookmark count 
  }

Google Apps脚本不支持该功能,请参阅此答案以获取指导。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM