How to pass data from HTML to server script or HTML to Client script in service portal?

Priyanka28
Giga Contributor

I have to pass data from server to HTML or vice versa how would i achieve that? 

1 ACCEPTED SOLUTION

AMIT SHISHODIA2
Giga Guru

You can do it like this
HTML:

<textarea id="comments" name="comments" rows="4" cols="30" ng-model="c.data.comments">
</textarea>

Server Side:

if (input && input.op && userApprovalAccess) {
gr.comments = input.comments;
}

In var field line,

use this 

var fields = $sp.getFields(gr, 'state,sys_created_on,comments');

 

use this below data.fields = fields;

var work = gr.comments.getJournalEntry(1);
var array = work.split(")");
data.comment = array[1];

Now,In comments we have got comment we entered


In HTML to display server side data use

Comment:<div>{{c.data.comment}}</div>

It will pass data from HTML to server side

Please mark correct and helpful if it helps you.
In case of any further help.please message me

View solution in original post

14 REPLIES 14

AMIT SHISHODIA2
Giga Guru

You can do it like this
HTML:

<textarea id="comments" name="comments" rows="4" cols="30" ng-model="c.data.comments">
</textarea>

Server Side:

if (input && input.op && userApprovalAccess) {
gr.comments = input.comments;
}

In var field line,

use this 

var fields = $sp.getFields(gr, 'state,sys_created_on,comments');

 

use this below data.fields = fields;

var work = gr.comments.getJournalEntry(1);
var array = work.split(")");
data.comment = array[1];

Now,In comments we have got comment we entered


In HTML to display server side data use

Comment:<div>{{c.data.comment}}</div>

It will pass data from HTML to server side

Please mark correct and helpful if it helps you.
In case of any further help.please message me

Hi Amit,

Thanks for the quick respond i will try this then let you know

OK Priyanka.I did same and get the output.

And how's client script and HTML communicate?