UI Page Button tag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 09:58 PM
Team,
I am in need for UI Page development for button tag.
I had requirement for UI Page display where need buttons to execute the Script include.
It would be very helpful how to call script include by passing parameters in button tag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 12:13 AM
Please use the below mentioned code
UI page: <button onclick="myFunc('Test')">Test</button>
Client Script:
function myFunc(parm1){
var ga = new GlideAjax('sampleScriptInclude'); // name of the script include...
ga.addParam('sysparm_name','sample'); // name of the function
ga.addParam('sysparm_id',parm1); // if you want to pass some parameter in the backend
ga.getXML(responseFunc);
function responseFunc(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}}
Script include:
code:
sample: function() {
return "here is my code";
},
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact!