You need to sign in to do that
Don't have an account?

Pass Recordset from Apex to Ajax
Hi ,
I want to pass a record set generated from apex controller class constructor to ajax on a vf page. I dont want to fire same query at controller and VF. How can this be achieved.
Thanks
Bikram...
What actually are you trying to achieve?
Anyways please refer to the enclosed code:-
VF Page Code
<apex:page controller="Test100Class">
<apex:page controller="Test100Class"> <script> function show() { var x=document.getElementById('{!$Component.form1.page1.textbox1}').value alert(x); } </script><apex:form id="form1" ><apex:pageBlock title="Congratulations {!$User.FirstName}" id="page1"><apex:inputHidden value="{!values}" id="textbox1"/><apex:commandButton value="Check" onclick="show()"/> </apex:pageBlock>
</apex:form>
</apex:page>
Controller Code
public class Test100Class {
public String values{get;set;}
public Test100Class()
{
for (Account a : [SELECT id, name, (SELECT lastname FROM contacts)FROM account WHERE id = :ApexPages.currentPage().getParameters().get('id')])
{
values = values +';'+ a.contacts;
}
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.