Visualforce Page:
<apex:page id="page">
<apex:includeScript value="/soap/ajax/24.0/connection.js"/>
<apex:includeScript value="/soap/ajax/24.0/apex.js"/>
<script>
sforce.connection.sessionId = '{!$Api.Session_ID}';
//alert(sforce.connection.sessionId);
function callapex(){
sforce.apex.execute('scriptcls','m1',{s:'ctrla'});
}
</script>
<apex:form id="form">
<apex:pageBlock id="pb1" >
<apex:outputLabel >Ctrl a</apex:outputLabel>
<apex:commandButton value="Call an Apex Class" onclick="callapex()"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Webservice Class:
global class scriptcls{
webservice static void m1( string s ){
System.debug('------------>'+s);
}
}
<apex:page id="page">
<apex:includeScript value="/soap/ajax/24.0/connection.js"/>
<apex:includeScript value="/soap/ajax/24.0/apex.js"/>
<script>
sforce.connection.sessionId = '{!$Api.Session_ID}';
//alert(sforce.connection.sessionId);
function callapex(){
sforce.apex.execute('scriptcls','m1',{s:'ctrla'});
}
</script>
<apex:form id="form">
<apex:pageBlock id="pb1" >
<apex:outputLabel >Ctrl a</apex:outputLabel>
<apex:commandButton value="Call an Apex Class" onclick="callapex()"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Webservice Class:
global class scriptcls{
webservice static void m1( string s ){
System.debug('------------>'+s);
}
}
No comments:
Post a Comment