How do you call server-side controller?

How do you call server-side controller?

Call a server-side controller action from a client-side controller. In the client-side controller, you set a callback, which is called after the server-side action is completed. A server-side action can return any object containing serializable JSON data.

What is server-side in Salesforce?

A server-side action can return any object containing serializable JSON data. Passing Data to an Apex Controller. Use action. setParams() in JavaScript to set data to pass to an Apex controller. Returning Data from an Apex Server-Side Controller.

What is client-side and server-side?

Server-side is the systems that run on the server, and client-side is the software that runs on a user’s web browser. Client-side web development involves interactivity and displaying data, server-side is about working behind the scenes to manage data.

How to call a server side action in Lightning aura?

The following component contains a button that’s wired to a client-side controller echo action. SimpleServerSideController contains a method that returns a string passed in from the client-side controller.

Can a callout be made from within an auraenabled method?

However, it is legal to make a callout from within an @AuraEnabled controller method. If you’re calling a web service to return data to your JavaScript controller, you must call the service synchronously, without using @future. This ensures you’ll receive a response in the same transaction that you can return to the client-side.

How does the @ auraenabled method work in apex?

$A.enqueueAction (action which calls the @auraEnabled method) adds the server-side controller action to the queue of actions to be executed. All actions that are enqueued will run at the end of the event loop.

How to call a client side action from a server side controller?

SimpleServerSideController contains a method that returns a string passed in from the client-side controller. This client-side controller includes an echo action that executes a serverEcho method on a server-side controller. Use unique names for client-side and server-side actions in a component.