Pass Variable from Apex controller to Javascript
1.Define the Javascript
var serviceFeesDict = {};
2.use ready fucntion to load the variable when page get loaded.
$(document).ready(function() {
<apex:repeat value="{!serviceFeesList}" var="serviceFee">
serviceFeesDict['{!serviceFee.Name}'] = {!serviceFee.Fee__c};
</apex:repeat>
}
3.use the Apex repeat var to iterate the value in JS.
var feesValue = 0;
if(isAA){
feesValue += serviceFeesDict['AA'];
}
if (isBB){
feesValue += serviceFeesDict['BB'];
}
1.Define the Javascript
var serviceFeesDict = {};
2.use ready fucntion to load the variable when page get loaded.
$(document).ready(function() {
<apex:repeat value="{!serviceFeesList}" var="serviceFee">
serviceFeesDict['{!serviceFee.Name}'] = {!serviceFee.Fee__c};
</apex:repeat>
}
3.use the Apex repeat var to iterate the value in JS.
var feesValue = 0;
if(isAA){
feesValue += serviceFeesDict['AA'];
}
if (isBB){
feesValue += serviceFeesDict['BB'];
}
No comments:
Post a Comment