2

I am using javascript remoting to get data from apex method.

My problem is javascript remoting is working Asynchronously.I want to work it as synchronously.

Please suggest me.

4

By definition, VF remoting (like AJAX) is asyncrhonous. As the official documentation states "The remote method call executes synchronously, but it doesn’t wait for the response to return. When the response returns, the callback function handles it asynchronously."

This link would help explain how to use the associated parameters when firing a remoting call -

Depending on what your exact use case is, you may want to handle the behavior appropriately in your callback function.

3

Use the below format

Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.ControllerName.methodname}',
                var1,var2,
                function(result, event){
                    if (event.status) {
                   //all code after remote controller will be here

                }, 
                {escape: true}
            );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.