Skip to main content
Code format + apex tag
Link
Dave Humm
  • 5.1k
  • 5
  • 25
  • 38

//Java Script code function fetchRecord() { MyCustomController1.fetchRecord(handlefetchStudent); }

function fetchRecord()
    {
       MyCustomController1.fetchRecord(handlefetchStudent); 
    }
        
     function handlefetchStudent(result,event){
         if(event.type == 'exception') {
              alert(event.message);
          } else {
              document.getElementById("resultDiv").innerHTML = result.toString(); 
           }
      } 

//Apex Controller Method @RemoteAction
public static Student__c fetchRecord() { Student__c student=[SELECT First_Name__c,Last_Name__c,Phone__c,Email_ID__c,Lang__c FROM Student__c LIMIT 1 ]; RETURN student; }

@RemoteAction    
    public static Student__c fetchRecord()
    {
      Student__c student=[SELECT First_Name__c,Last_Name__c,Phone__c,Email_ID__c,Lang__c
                            FROM Student__c 
                            LIMIT 1
                           ];
                RETURN student;
       }

//its Showing me [object Object]

[object Object]

How to fetch and dispaly data from this result?

//Java Script code function fetchRecord() { MyCustomController1.fetchRecord(handlefetchStudent); }

 function handlefetchStudent(result,event){
     if(event.type == 'exception') {
          alert(event.message);
      } else {
          document.getElementById("resultDiv").innerHTML = result.toString(); 
       }
  } 

//Apex Controller Method @RemoteAction
public static Student__c fetchRecord() { Student__c student=[SELECT First_Name__c,Last_Name__c,Phone__c,Email_ID__c,Lang__c FROM Student__c LIMIT 1 ]; RETURN student; }

//its Showing me [object Object]

How to fetch and dispaly data from this result?

//Java Script code

function fetchRecord()
    {
       MyCustomController1.fetchRecord(handlefetchStudent); 
    }
        
     function handlefetchStudent(result,event){
         if(event.type == 'exception') {
              alert(event.message);
          } else {
              document.getElementById("resultDiv").innerHTML = result.toString(); 
           }
      } 

//Apex Controller Method

@RemoteAction    
    public static Student__c fetchRecord()
    {
      Student__c student=[SELECT First_Name__c,Last_Name__c,Phone__c,Email_ID__c,Lang__c
                            FROM Student__c 
                            LIMIT 1
                           ];
                RETURN student;
       }

//its Showing me

[object Object]

How to fetch and dispaly data from this result?

Source Link
G.Ganesh
  • 31
  • 2
  • 7

How To Show Result On Visual Force Page?

//Java Script code function fetchRecord() { MyCustomController1.fetchRecord(handlefetchStudent); }

 function handlefetchStudent(result,event){
     if(event.type == 'exception') {
          alert(event.message);
      } else {
          document.getElementById("resultDiv").innerHTML = result.toString(); 
       }
  } 

//Apex Controller Method @RemoteAction
public static Student__c fetchRecord() { Student__c student=[SELECT First_Name__c,Last_Name__c,Phone__c,Email_ID__c,Lang__c FROM Student__c LIMIT 1 ]; RETURN student; }

//its Showing me [object Object]

How to fetch and dispaly data from this result?