function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karthick RajaKarthick Raja 

How to use Remote action annotation

Hi folks,
        Can anyone tell me how to use Remote action annotation in Apex controller/?
We can use public variables in RemoteAction method in Visualforce?


Thanks in advnce
Karthick
Best Answer chosen by Karthick Raja
Mikola SenykMikola Senyk
You can use @RemoteAction annotation with static method only. As a result you can't use public variable directly even if remote action is declared in the same controller.
However, you can pass through public variables via JavaScript as a parameters of remote action.

All Answers

Mikola SenykMikola Senyk
You can use @RemoteAction annotation with static method only. As a result you can't use public variable directly even if remote action is declared in the same controller.
However, you can pass through public variables via JavaScript as a parameters of remote action.
This was selected as the best answer
Karthick RajaKarthick Raja
@Mikola Senyk,
        Thanks for your response.
Can we use global variable(declared in controller) in RemoteAction method?

Thanks in advance
Karthick

 
Mikola SenykMikola Senyk
If global variable is static only.
Karthick RajaKarthick Raja
Thnks dude