1

I am attempting to import the client.js library for the Trello API. This is so that I can use the Trello object and its methods in my code.

The error comes when I run this line:

eval(UrlFetchApp.fetch('http://code.jquery.com/jquery-1.7.1.min.js').getContentText());

Is there anyway to fix this error/import this library? Or, because GAS is a server side, is it impossible?

Is there another way you suggest I go about importing this library?

Thanks.

  • Why are you using `eval()` (which is evil and should rarely, if ever be used)? – Scott Marcus Jun 12 '17 at 18:09
  • The answer was suggested in this problem-https://stackoverflow.com/questions/18646554/importing-external-javascript-to-google-apps-script It was recommended I use this method. – Jaden Ranzenberger Jun 12 '17 at 18:20
  • you are mixing client code in server code. make sure you have both concepts clear beforehand. it is possible to use from gas. – Zig Mandel Jun 12 '17 at 18:58

1 Answers1

0

I believe jQuery requires access to the document object model, which is not available in GAS. You might want to consider using another library that does not depend on the existence of DOM, such as Underscore.

Hao Zhang
  • 211
  • 2
  • 7