How can I add external javascript library to any UI page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2017 09:38 PM
Hi Team,
I have created an UI page and I want to add javascript library to my html code how can I do. I want to add this lib https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js
I went thru this link (UI Scripts - ServiceNow Wiki) but Its giving me an error "Uncaught invalid module definition, module id must be defined and be a string"
Otherwise please let me know for this structure <script>https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js "></script> how can I embed this, Is it possible in ServiceNow <script>https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js "></script>
UI page code -
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<head>
<script></script> // ADDED UI SCRIPT
</head>
<body>
<div id="content">
<h3>Hello, this is a H3 tag</h3>
<p>a pararaph jjfsafoidaf</p>
</div>
<div id="editor"></div>
<button id="cmd">generate PDF</button>
</body>
</html>
</j:jelly>
NOTE- If there is another way to achieve this please let me know guys. TIA
Thanks,
Jeet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2017 10:33 PM
Hi Jitendra Ji,
Your UI page code looks correct for me.
For more information goto the below link.
Jenkins dev - JavaScript in .jelly files
Thanks
Madhava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 06:44 AM