I want to call method in an apex class in header part of customer portal which is a HTML page (not a VF page).
Is it possible to access apex class method in such a way, If yes, then how to start on this?
I want to call method in an apex class in header part of customer portal which is a HTML page (not a VF page).
Is it possible to access apex class method in such a way, If yes, then how to start on this?
https://developer.salesforce.com/page/Apex_Web_Services_and_Callouts Check this out. This is a very useful blog.
I believe you have an external page and you are trying to access an apex method. For this the apex class must be a web service class. This means a global class exposed. like this
global class AccountPlan {
webservice static Plan createAccountPlan(Plan vPlan) {
//add logic here......
}
}
And from your HTML page you can call this method using AJAX calls.
Hope this was useful
Try something like this :
VF :
<div id="header">
<script language="javascript">
var myControllerMethod = '{!myControllerMethod}';
</script>
</div>
Controller :
public with sharing class MyClass {
public String getMyControllerMethod () {
//Do some stuff
return null;
}
}
controller field in your <apex:page> tag. Here it's <apex:page controller="MyClass">