What is the difference between getXml() and getXmlWait()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 08:53 AM
Hi All,
In GlideAjax, what is the diff between getXml() and getXmlWait().
Thanks
Charliee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 09:10 AM
Technically speaking, getXMLWait() is a Synchronous call and getXML() is aSynchronous.
What this means in everyday terms:
- getXMLWait() is used when you want to halt processing until the results are returned. This will halt everything and wait for it to finish and return the results
- getXML() is used when you want processing to continue, even if the results have not been returned
What you plan to do will help you decide which will work best. In our instance, we have had situations where we do want to wait for the results before continuing (even though it will take a few seconds). However, for the most part, we use getXML and a callback function for the vast majority of our uses.
I hope that made sense. I am sure someone more knowledgeable can give you a much more indepth answer.
EDIT: I recall in our ServiceNow training that getXML (aSynchronous) is the preferred/recommended method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2014 10:20 AM
Hi Charlie,
What trevor had specified is absolutely right.I wanna add one more point on it for better understanding of concept.
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();
Please go through this link...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2015 07:36 AM
I had a further question about this:
does getXML() require the callback function parameter?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2017 09:55 AM
Hi Daniel,
Yes, getXML() needs the callback function.
for Reference :
- gr.getXML(setValue);
function setValue(response)
{
var answer = response.responseXML.documentElement.getAttribute("answer");
}
Best Regards.
Priyanka R