- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 12:16 AM
hi what is the work of "answer"....and what is get Attribute doing here pleae any one can explain me the complete line var answer = response.responseXML.documentElement.getAttribute("answer");
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 02:27 AM
var answer =response.responseXML.documentElement.getAttribute("answer");
Let us assume we have a function in Script Include :
demofunction: function () {
var element = this.getParameter('sysparm_parameter');
return 'Hi, This is bind with answer atrribute';
}
Now in client script -
function myCallBack(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer); // Output "Hi, This is bind with answer atrribute"
}
Here "response" is an XML document which contains an attribute "answer" and the value returned from the demofunction binded with the answer attribute.
So response.responseXML.documentElement.getAttribute("answer") gives us the value returned from the script include function.
Award Correct Answer if my Solution Works, Mark helpful if it helps...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 12:36 AM
This link should better explain you, check the GlideAjax section:
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 12:47 AM
The response you get after a server side call(glideajax), will be stored in a format of XML.
You need to parse the response to get the answer attribute:
XML Hierarchy:
response -> responseXML -> documentElement -> Answer(place where the result are stored)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 01:38 AM
so gowrisankar,
response or answer is fixed keyword here or we can use any varaible name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 02:31 AM
Yes,
var answer =response.responseXML.documentElement.getAttribute("answer");
var answer -> is a variable you define, even you can define var result
response.responseXML.documentElement.getAttribute("answer"); -> here answer is a value in XML Tag that we receive after server call.