- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2019 04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2019 05:40 AM
getXMLAnswer() saves you a line of code every time you use it. That is it. There shouldn't be any noticeable difference in speed, though this method is probably guaranteed to be slightly slower as it runs at least one more line of code each time. So ease of use vs minuscule difference in speed.
with getXMLAnswer() uou no longer need this line of code.
var comments = response.responseXML.documentElement.getAttribute("answer");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2019 05:47 AM
Hi,
If we compare both then getXML() is best option for performance wise. Beacause it is not wait for response.
When you are trying to retrieve value of the variable.after getting value then only we can proceed next step like comparing it with user input.In such scenarios will use
getXMLWait()
If you are retrieving some data from server and next tasks does not depend on what you are retrieving from server
then will use
getXML();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2019 05:48 AM
Hi mallikharjunaswamyvutla,
getXML(Function callback)
Sends the server a request to execute the method and parameters associated with this GlideAjax object.
The server processes the request asynchronously and -- when ready -- returns the results via the function specified as the callback_function.
Name | Type | Description |
---|---|---|
callback | Function |
The name of the callback function to process the results returned by the server.
|
getXMLAnswer(Function callback)
Call the processor asynchronously and get the answer element of the response in XML format.
Name | Type | Description |
---|---|---|
callback | Function |
The callback function. The function receives the answer element of the response in XML format as an argument. |
THANKS !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2019 05:50 AM
Hi,
It all depends on the scenario you are into
1) getXMLWait() is used during onsubmit validation when you are waiting for the script include response so that you can abort the form save
2) getXML() is used when you don't want to wait for the script include function and asynchronously execute the code
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2020 12:03 PM
Hi Ankur,
its other way around..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2020 07:59 PM
Thanks Amit.
Updated the comment.
Regards
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader