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

Retrieving a String list from Apex get function with Javascript in VF

Is there a way to return a JavaScript array of Strings from Apex? Or is there a datatype in Javascript I need to use for an Apex List<String>?



A simple example of what I'd like to do:


Apex function:


public List<String> getStringList(){


    List<String> example =  {"","",""};


   return example;




Javascript function in VisualForce


var stringList;

function() {


stringList = {!String};







Not sure if this is what you are looking for, but you can do this ...




public List<String> getStringList(){

     List<String> example =  {"","",""};

    return example;



<apex:dataTable value="{!StringList}" var="sl" >
<apex:column headerValue="email address" value="{!sl}"/>




Thanks for the suggestion but that wouldn't work for my problem. Sorry, if the example I gave suggested that I was trying to output the strings into a datatable. I'm trying to bring up several custom fields from a list of accounts to add to an infowindow inside a google maps api. Currently, I return one long string and split it up into substrings of the data I need. I'd like a way to access an array or list of those strings or any other datatypes. Is there a way to do that?