google apps script - ReferenceError: "$" is not defined in Client Side? -


in google apps scripts, i'm trying use jquery in templating html. i'm receiving following error:

referenceerror: "$" not defined.

index.html

<html>   <head>     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>   </head>   <body>    favorite google products:   <? var data = ['gmail', 'docs', 'android']; ?>   <? $(data).each(function(){ ?>     <?= ?>   <?}); ?>    </body> </html> 

code.gs

function doget() {   return htmlservice     .createtemplatefromfile('index')     .evaluate(); } 

tag <? means code runs on server, , server side seems jquery not loaded, $ reference not exist.

something should work without problem:

<html>   <head>     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>     <script>        $(function() {           var data = ['gmail', 'docs', 'android'];           var products = $('#products');           $(data).each(function(index, value) {              products.append('<li>' + value + '</li>');           });        });     </script>   </head>   <body>       favorite google products:   <ul id="products"/>   </body> </html> 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -