+ Start a Discussion
Ganesh Babu 7Ganesh Babu 7 

Help Needed - How to pass the Java Script Array output to VF Page ( Without Apex Controller)

I need to bring the Javascript array output(list of record) into visualforce page and display in the Apex:repeat.
Without Apex Controller.

Code Below:

<apex:page >
    <script src="../../soap/ajax/43.0/connection.js" type="text/javascript"></script>
    <Script>
        function theme1(){
        sforce.connection.sessionId='{!GETSESSIONID()}'; 
        var result=sforce.connection.query('select name,description from Account limit 5');
        var myresult = result.records;
        var output='';
        var outputs=new Array();
        for(var i=0;i<myresult.length;i++)
        {
        outputs.push(myresult[i].Name);
        }            
      }
    </Script>    
    <apex:form id='f1'>
            <apex:commandButton value="save" onclick="theme1()"  status="whatstat" reRender="out" />    
            <apex:actionStatus id="whatstat" >
            <apex:repeat  value="outputs" var="a">   
              {!a}            
            </apex:repeat>
    </apex:form>
</apex:page>
Ajay K DubediAjay K Dubedi
Hi Ganesh,

You need to add value="{!outputs}"  instead of  value="outputs"

Hope this solution helps.

Thank You
Ajay Dubedi