How to pass data from client script to html in UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 11:20 PM - edited 08-07-2024 11:21 PM
Hi,
I have a UI Page where I need some advice/help on how can we display the answer retrieved in Client script and need to be passed to HTML as soon as a the page loads?
Right now, I have the info in my client script which is coming from Script include but unable to display it in UI PAGE as not sure on how can we pass the value to HTML.
My code below:
HTML:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 11:27 PM
Hi @Shivam32 ,
Please try the below suggested ways:
UI Page - How to pass value from Client Script to HTML
Pass value from Client Script to UI Page
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 11:30 PM - edited 08-07-2024 11:36 PM
Hello @Shivam32 ,
Please refer below link.
If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 12:14 AM
@Ankur Bawiskar Could you please suggest. How can we fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 12:33 AM
try this -> don't set mention any text within paragraph tag; set it via script from client script
HTML: Update as this
<p id="answer"></p>
this will work in client script
document.getElementById('answer').innerHTML= 'User Status ' + answer;
OR
document.getElementById('answer').innerText= 'User Status ' + answer;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader