kindly let me know how to display records using @remoteAction on vf page. kindly rectify my vf page code.currently its displaying null values. Thanks.
apex class:-
public class javascriptremoting {
@remoteAction
public static List<Account> loadaccs(){
return [select Id,Name from Account];
}
}
vf page:
<apex:page controller="javascriptremoting" id="pg">
<div id="ot" >
{!names}
</div>
<script>
javascriptremoting.loadaccs(function(result,event){
var names=[];
//var names='';
for(integer i=0;i<=result.length;i++){
names=result[i].Name;
}
document.getElementById('ot').innerHtml=names;
});
</script>
</apex:page>