Parse response on UI page

Snehal13
Kilo Sage

I have a UI page with a submit button which when click must generate a table to show all incidents created on current date. I am able to pass date to server script from glideajax in UI page and able to get response back in the client script.

 

My question is how to parse the response using jelly script and show the data in table below the submit button on the same UI page. any specific function to rely on for looping over. This data returned from Server script is JSON  that is to be parsed and shown in proper data

1 ACCEPTED SOLUTION

AnirudhKumar
Mega Sage
Mega Sage

Couple of observations:

1. If you have a <form> or <g:ui form>tag, then the button is simply going to refresh the page, and you will lose the data. So, I hope you do not have both these tags.

2. A regular parse() function is sufficient to handle your return value on the UI Page.

3. I understand you are populating your table... building the <tr> and <td> dynamically based on the server response. My go-to solution for such scenarios is to use for-loop and jQuery methods for table.

 

 

View solution in original post

3 REPLIES 3

AnirudhKumar
Mega Sage
Mega Sage

Couple of observations:

1. If you have a <form> or <g:ui form>tag, then the button is simply going to refresh the page, and you will lose the data. So, I hope you do not have both these tags.

2. A regular parse() function is sufficient to handle your return value on the UI Page.

3. I understand you are populating your table... building the <tr> and <td> dynamically based on the server response. My go-to solution for such scenarios is to use for-loop and jQuery methods for table.

 

 

Not using form but a button click event (submitting by clicking the button) must show the data from server onto the UI page. Help required on how to parse the response using jelly script supported by ServiceNow UI page. 

 

How to use js methods to loop over the response object 

Could you please send the code you have. 

And a sample response from server?