UI Page display object from client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2020 06:51 AM
Hello,
I want to display in my UI Page objects received from GET REST Message declared in my client script. How I can display them?
Client script :
function Search(){
var nameInput = document.getElementById('text').value;
if(nameInput){
var re = new GlideAjax('SPAjaxUtils');
re.addParam('sysparm_name','getData');
re.addParam('input', nameInput);
re.getXMLAnswer(DataBack);
}
function DataBack(response){
var b = JSON.stringify(response);
var data = JSON.parse(b);
console.log(data);
}
}
As You can see in variable called "data" there is array of received records. How I can display them on UI Page in HTML
Best regards,
Artur
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2020 07:41 AM
Hello Artur,
When you say client script, do you mean the client script field on the UI Page or actual Client Script records?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2020 12:47 AM
Hello Pilssken !
I talking about client script field on the UI Page 😄
Under the HTML field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2020 12:59 AM
Hi Artur,
assign the data to $scope.data = data;
in html code u can use angularjs scripting. like
<div ng-repeat="fields in data.items"><p>{{fields.val}}</p></div>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2020 01:22 AM
you can directly call server side script inside the html part.
make it as server side and pass the html input value as parameter.
eg:
var jamesCurrencyFormatter= Class.create();
jamesCurrencyFormatter.prototype = {
initialize: function() {
},
formatCND : function(decimalvalue) {
return '$' + decimalvalue;
},
type: 'jamesCurrencyFormatter'
};
HTML:
<td class="test_ui" colspan="1">${var cur = new jamesCurrencyFormatter(); cur.formatCND(<your parameter)}</td>