GlideAjax call to server side.

niveditakumari
Mega Sage

Hi, 

 

GlideAjax call to server side. 

When we use client script to call server script then we use 

line 1 ga.getXML(callBackFunction); 

line 2 function callBackFunction(response) { 

line 3 var answer = response.resonseXML.documentElement.getAttribute(answer); 

 

I have used it many times. 

Can anyone please make me understand line 1, line 2, line 3, why we use this line everytime in client script. 

 

Regards, 

Nivedita

 

 

 

1 ACCEPTED SOLUTION

Rahul Talreja
Mega Sage
Mega Sage

Hi @niveditakumari ,

I could write the answer for this, but I am happier to share a link which will answer your query as well as give you a deep view of all which you're using.
I hope this might help you a lot to understand the perspective of every function well.

GlideRecord & GlideAjax: Client-Side Vs. Server-Side - ServiceNow Developer Pro-Tips (snprotips.com)
This article has line by line explanation of the code you have!

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

View solution in original post

3 REPLIES 3

Rahul Talreja
Mega Sage
Mega Sage

Hi @niveditakumari ,

I could write the answer for this, but I am happier to share a link which will answer your query as well as give you a deep view of all which you're using.
I hope this might help you a lot to understand the perspective of every function well.

GlideRecord & GlideAjax: Client-Side Vs. Server-Side - ServiceNow Developer Pro-Tips (snprotips.com)
This article has line by line explanation of the code you have!

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi @Rahul Talreja

 

Thank you so much. 

This article has really great explanation. 

 

Regards, 

Nivedita

 

 

-O-
Kilo Patron
Kilo Patron

What @Rahul Talreja says, but also because people have not heard of getXMLAnswer in which case your step 3 is not needed, because GlideAjax executes that internally and passes in answer to callBackFunction:

line 1 ga.getXMLAnswer(callBackFunction);

line 2 function callBackFunction(answer) {