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
LearnerrrLearnerrr 

Load object records in table form on VF page using javascript Remote action ,whenever click on save button

Raj VakatiRaj Vakati
Refer this link 

https://webkul.com/blog/remote-action-function-visualforce-page/

 
global with sharing class ContactJs {  
    /**
    * Webkul Software.
    *
    * @category  Webkul
    * @author    Webkul
    * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
    * @license   https://store.webkul.com/license.html
    */
    public ContactJs() { } // empty constructor    
 
    @RemoteAction //the function to be called in remote action should use this annotation
    global static list<Contact> getcon() {
        //function should be static and global else it will throw error
        list<Contact> con1 = [SELECT id,name FROM contact limit 5];
        if(con1!=null && !con1.isEmpty()){        
            return con1;        
        }else{        
            return  new list<contact>();        
        }
    }
}
 
<apex:page controller="ContactJs">
    <!-- 
        /**
         * Webkul Software.
         *
         * @category  Webkul
         * @author    Webkul
         * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
         * @license   https://store.webkul.com/license.html
         */
     -->
    <script type = "text/javascript">
    function getRemoteContact() {
        var a;
        Visualforce.remoting.Manager.invokeAction(
            //Invoking controller action getcon
            '{!$RemoteAction.ContactJs.getcon}',
             
            function(result, event){
               //We can access the records through the parameter result
               //event.status determines if there is error or not 
               if(event.status){
                    document.getElementById('remoteContactId').innerHTML = 'Contact Name: <br/><br/>';
                    for(a=0;a<result.length;a++){                        
                        document.getElementById('remoteContactId').innerHTML +=  result[a].Name +'<br/>';                    
                    }                                       
               }               
            },
            {escape: true}
        );
    }
    </script>
 
    <button onclick="getRemoteContact()">Get Contact</button>
    <div id="responseErrors"></div>
    <apex:pageBlock id="block">        
        <apex:pageBlockSection id="blockSection" columns="2">
                <span id="remoteContactId"></span>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
LearnerrrLearnerrr
This is helpfull to me but I want to get the data for multiple fields Like caseNmber,ID,Subject,Type in table format ,so how to get this in table ?