0

I have a VF page where i need to make synchronous call.Is there any possibility for making Visualforce remoting call synchronous.

  • 1
    What exactly are you trying to achieve? I don't think you can make it synchronous, but you could probably do something like disable the page while the call is occurring. – Caspar Harmer Dec 3 '15 at 18:14
  • 2
    This is one of those questions where you're asking how you can use a hammer to cut a plank of wood, instead of asking what tool you should use to cut a plank of wood. You should ask a new question focused on the original problem, not on how to use a tool incorrectly. You'll get much better (and useful) answers this way. – sfdcfox Dec 3 '15 at 18:43
  • Why not use actionFunction definitions instead? These allow you to use controller/extension functionality (albeit stateful instead of static). The key is that they do in fact run synchronously (at least I believe they do). – Adrian Larson Dec 3 '15 at 19:45
8

No. The framework requires a callback function, and it will always run asynchronously. Besides, it's now deprecated in most browsers (you'll get warnings in the console), so you shouldn't try to make any callouts synchronous, as this model may very well be disabled entirely in the future. The reason why it's asynchronous is because JavaScript isn't multithreaded, so a synchronous read freezes the entire browser until it's done.

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.