function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gm ChouhanGm Chouhan 

apex list value store into java array variable

hi,
i have create list in apex and i want to list value into java script array variable.
pls help me.....
Ashish_SFDCAshish_SFDC
Hi , 


See the links below, 

https://developer.salesforce.com/forums?id=906F000000098PgIAI

https://developer.salesforce.com/forums?id=906F000000096x0IAA

https://developer.salesforce.com/forums?id=906F000000096kcIAA

https://developer.salesforce.com/forums?id=906F000000096QxIAI

http://salesforce.stackexchange.com/questions/8200/converting-from-list-to-array


Regards,
Ashish

sunny522sunny522
Hi Chouhan,
       Go through simple example below.
Apex class:

public class DisplayArrayList{
public list<string> Arraylist{get;set;}
public DisplayArrayList(){
Arraylist=new list<string>();
Arraylist.add('January');
Arraylist.add('February');
Arraylist.add('March');
Arraylist.add('April');
Arraylist.add('May');
Arraylist.add('June');
Arraylist.add('July');
Arraylist.add('August');
Arraylist.add('September');
Arraylist.add('October');
Arraylist.add('November');
Arraylist.add('December');

}

}

visualforce page:

<apex:page controller="DisplayArrayList">
<script>
window.onload=function test(){
var s='{!Arraylist}';
alert(s);
}
</script>
{!Arraylist}
</apex:page>

if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
James LoghryJames Loghry
An easy way is to convert your array in Apex to a Json string, and then use that in your Javascript / Visualforce page.  See the following blog post for an excellent example: https://developer.salesforce.com/page/Getting_Started_with_Apex_JSON