UI Page display object from client script

Artur Poswiata1
Kilo Contributor

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

5 REPLIES 5

Plissken
Tera Expert

Hello Artur,

When you say client script, do you mean the client script field on the UI Page or actual Client Script records?

Hello Pilssken !

I talking about client script field on the UI Page 😄
Under the HTML field

Anjaneyulu Muv1
Tera Expert

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>

 

Harsh Vardhan
Giga Patron

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>