- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 05:15 AM - edited 06-17-2023 05:18 AM
Could you please explain me with more details, what does the below code lines (Red and underlined) does.
var MyFavoritesAjax = Class.create();
MyFavoritesAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getFavorites: function() {
},
type:"MyFavoritesAjax"
});
Client script:
function callback(response) {
var result = response.responseXML.getElementsByTagName("result");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 06:28 AM
The above line is a class that is been extended just like we do in java which follows object oriented approach.
<classname>.prototype = object.extendobject(extending class),{ your script
Usually by default we extend AbstractAjaxProcessor which is used for GlideAjax.
For other
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.
Please Mark helpful or correct Answer , If it solves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 06:28 AM
The above line is a class that is been extended just like we do in java which follows object oriented approach.
<classname>.prototype = object.extendobject(extending class),{ your script
Usually by default we extend AbstractAjaxProcessor which is used for GlideAjax.
For other
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.
Please Mark helpful or correct Answer , If it solves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 06:41 AM - edited 06-17-2023 06:42 AM
Thanks a lot , also could me explain about in type:"MyFavoritesAjax" GlideAjax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 07:13 AM
It is the property used by servicenow as a part of default syntax, as servicenow is build on java.
Can you please mark it as correct answer if it resolve your query .