You need to sign in to do that
Don't have an account?
Muhammad Hammad 8
How do I pass data from controller to javascript
global class demo{ global static String getSettings(){ user__c setting = user__c.getInstance(); return setting.data__c; } }
<apex:page docType="html-5.0" controller="demo" > <apex:form > <apex:actionFunction name="hello" action="{!getSettings}" /> </apex:form> <script> window.setTimeout( console.log(hello()) ,1000) </script> </apex:page>I'm following this (https://youtu.be/aqztf1nJv-k?t=1944) tutorial for protected custom settings and I want to show this data using javascript.
Hi Muhammad,
Please check out below blog, which would help you on how to pass values from apex controller to javascript.
https://blog.jeffdouglas.com/2011/01/17/passing-values-to-javascript-from-apex-controller-method/
Hope above information helps. Please mark as Best Answer so that it can help others in future.
Thanks.