GlideAjax (async)
Quick answer
GlideAjax is how a client script asks the server a question, 'what is this user's manager?', 'is this value unique?', and gets an answer asynchronously, without blocking the browser. It is the correct, performant alternative to synchronous lookups that freeze the form.
Key takeaways
- Two halves
- Why it matters
- Try it Yourself
GlideAjax is how a client script asks the server a question, 'what is this user's manager?', 'is this value unique?', and gets an answer asynchronously, without blocking the browser. It is the correct, performant alternative to synchronous lookups that freeze the form.
Two halves
You write a client-callable Script Include (extending AbstractAjaxProcessor) and call it from the client with GlideAjax.
getXMLAnswer (or getXML) with a callback. The synchronous variants (getXMLWait) block the browser and are strongly discouraged, they are the classic cause of 'the form hangs' complaints.Why it matters
GlideAjax keeps forms responsive while still reaching real server data and logic. Combined with a well-factored Script Include, the same server method serves client scripts, business rules and widgets.
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
GlideAjax lets a client script...
- A. Call server logic asynchronously
- B. Edit the database directly
- C. Restart the instance
Show answer
A. Call server logic asynchronously
It calls a server Script Include without a page reload.
The server Script Include must extend...
- A. AbstractAjaxProcessor
- B. GlideRecord
- C. GlideForm
Show answer
A. AbstractAjaxProcessor
Client-callable Script Includes extend AbstractAjaxProcessor.
You should retrieve the answer with...
- A. An async callback (getXMLAnswer)
- B. getXMLWait (sync)
- C. alert()
Show answer
A. An async callback (getXMLAnswer)
Async callbacks keep the form responsive; sync blocks the browser.