Tag: 谷歌 应用程序 脚本

将JSON传递给JQuery函数Javascript

我们有一个非常简单的Google Apps脚本Web应用程序,其目的是在HTML下拉列表中显示JSON数据。 JSON文件存在于Google云端硬盘中。 灵感代码来自: http : //jsfiddle.net/manoj_admlab/Mta5b/3/ 但是当我们尝试“获取Json”时,没有数据被加载到下拉列表中: 的index.html Select Fetch JSON google.script.run.getJson(); // Runs the function “getJson();” in Code.gs $(‘#fetch’).click(function(s) { $.post(s, {json: JSON.stringify(json)}, function(data) { $.each(data.Destinations, function(i, v) { $(‘#destinations’).append(” + v.destinationName + ”); }); }); }); Code.gs function doGet() { var template = HtmlService.createTemplateFromFile(‘index’); var htmlOutput = template.evaluate() .setSandboxMode(HtmlService.SandboxMode.NATIVE); return htmlOutput; } […]

服务器端代码无法在谷歌应用程序脚本中使用

嗨,我想做一个简单的事情:1)在我的HTML页面中创建两个链接2)当用户点击link1-我希望它调用显示“Hello World”的服务器端function。 但是,当我点击link1-我无法看到“Hello World”在任何地方显示。 我已尝试多次使用不同的变体,但它不起作用。 提前致谢 !! 这是我的代码 Code.gs function doGet() { return HtmlService.createTemplateFromFile(‘IndexHTML’).evaluate() .setTitle(‘Simple App’) .setSandboxMode(HtmlService.SandboxMode.IFRAME); } function doSomething(){ return ContentService.createTextOutput(‘Hello World’); } IndexHTML.html Simple App Click on the buttons to view roles I am index1 I am index2 JavaScript.html $(document).ready(function() { $(“#index1”).click(function() { google.script.run.doSomething() ; } }); }); Stylesheet.html body { background-color:red; }

在Google App Scripts上使用jQuery手风琴中的表单结构

我在谷歌应用程序脚本中的HTML服务上使用手风琴结构(jQueryUI)中的表单。 表单结构看起来像这样: 相关代码如下: Academic Information Choose from a Student Type: Resident Student Non-Resident Student Stipulated period of Education : 4 Years – 15 cr./semester 5 Years – 12 cr./semester 6 Years – 10 cr./semester 7 Years – Non-Traditional 8 Years – Non-Traditional Campus Housing What is the nature of Housing Plan you wish to subscribe: […]

我应该在哪里调用getUserProperties函数?

我正在尝试创建一个按钮,在单击时,“保存”连接可排序的多个列表的位置。 我希望脚本能够在刷新页面时保留每个列表项的最新位置( 即如果列表1以A,B,C开头,我将其更改为B,A,C并刷新页面,它保持为B,A,C。 )。 我试图通过从html文档创建一个数组(发布为Web应用程序),使用getUserProperities函数保存它,然后在下次打开Web应用程序时返回它。 我可以毫无问题地记录位置,但是我无法确定运行getUserProperities函数的位置,或者我可能正在处理的其他问题。 在Web应用程序的控制台中,我收到此错误Uncaught TypeError: Cannot read property ‘getUserProperties’ of undefined at saveList (userCodeAppPanel:4) at HTMLButtonElement.onclick (userCodeAppPanel:1) 。 我应该在哪里调用getUserProperties函数? 来自code.gs或index.html ? 我一直在研究这里提供的例子。 我的代码的相关部分来自index.html ,如下所示。 $( function() { $( “#myList, #flight1a, #flight1b, #flight2a, #flight2b, #flight3a, #flight3b, #sortable2” ).sortable({ connectWith: “.connectedSortable”, update: function(event, ui) { var changedList = this.id; var order = $(this).sortable(‘toArray’); var […]

在Google Script HTML Service中刷新div或整页

我在刷新Google Apps脚本中的HTML页面或div内容时遇到了困难。 我在编程方面自学成才,所以我对整个工作知之甚少; 请耐心等待我的代码。 基本上,我有一个应用程序,一旦用户点击按钮,它就会更改Google文档中的信息并刷新应用程序以显示更改。 我需要有关刷新部分的帮助。 这是html服务部分的片段: … New Requests <? for (var i = 0; i <? for (var j = 0; j Name:    School:    Program Type: First Choice at:    <input onclick="google.script.run.finalTime('’,’First’)” type=”button” value=”Finalize First Choice”> Second Choice at:    <input onclick="google.script.run.finalTime('’,’Second’)” type=”button” value=”Finalize Second Choice”> Third Choice at:    <input onclick="google.script.run.finalTime('’,’Third’)” type=”button” value=”Finalize Third Choice”> […]