1

my controller have on list of id

// list in controller

List<Id> ids {get;set;}

when i call javascript fuction i have to add id which i have passed to that function

//fuction in vfp

<script type="text/javascript">
 function listaccess(cid)
    {

        '{!ids}'.add(cid);
    }

</script>

this is not working

please help me

0

1 Answer 1

1

Ranjit,

you can create a controller method to add/update the list and call that method from your javascript.

public PageReference UpdateMyList(Id myId){
   ids.add(myId);
   return null;
}

and you have couple of options [Action Function or Remote Action] in calling the controller method from your VF page / script

refer this prvious answer for more details on both the options Calling a Apex controller method using JavaScript in VF page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .