I have a VF page where i need to make synchronous call.Is there any possibility for making Visualforce remoting call synchronous.
1 Answer
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.
actionFunction
definitions instead? These allow you to usecontroller
/extension
functionality (albeitstateful
instead ofstatic
). The key is that they do in fact runsynchronously
(at least I believe they do).