in Technology by
How can you call a controller method from JavaScript?

1 Answer

0 votes
by

To call a controller method (Apex function) from JavaScript, you need to use actionfunction.

Look at the below piece of code to understand how a controller method is called using actionfunction.

1

2

3

4

5

6

<script>

function JSmethodCallFromAnyAction()

{

callfromJS();

}

</apex:page>

Related questions

0 votes
    How to pass a map from controller to javascript function in VF page?...
asked Dec 10, 2020 in Technology by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    What is the easiest way to call a web service from Excel (I am using version 2002)? Please, no ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    What is the easiest way to call a web service from Excel (I am using version 2002)? Please, no ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    How will you call a static method of an interface in a class in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you call a default method of an interface in a class in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    I found this example on the official site of DialogFlow using Node.js and it is working fine, but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I've managed to read some values into a table view and display them in the Master View of a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am trying to call a method from the script Dice and after that method is executed the value of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    How to deep dive into the execution of a method from a method call? (a) F3 (b) F5 (c) F7 (d) ... Server Technologies & Servlet of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    How to deep dive into the execution of a method from a method call? (a) F3 (b) F5 (c) ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    ______________ are JS functions that you can call from your templates, and encourage you to reuse code and build complex templates a)Expressions b)Helpers c)Template d)Context...
asked Apr 29, 2021 in Technology by JackTerrance
0 votes
    What are the different return types used by the controller action method in MVC?...
asked Dec 8, 2020 in Technology by JackTerrance
...