You need to sign in to do that
Don't have an account?
Visualforce Remoting Disappears...
Does anyone know any reason why the Visualforce manager snippet disappears from a Visualforce page randomly?
When I open a Force.com Sites visualforce page, I get the following near the top of my source code:
Visualforce.remoting.Manager.add(new Visualforce.remoting.RemotingProviderImpl({"service":"apexremote","vf":{"tm":__________,"dev":false,"vid":"__________","dbg":false,"tst":false},"actions":{"_NAMESPACE_._CLASS_":{"ms":[{"name":"_METHOD_","len":1,"ns":"_NAMESPACE_","ver":26.0,"csrf":"__________________________________________________________________________________________"},{"name":"_METHOD_","len":1,"ns":"_NAMESPACE_","ver":26.0,"csrf":"__________________________________________________________________________________________"}],"prm":0}}}));
Once I've done some remote visualforcing and the user is redirected to a new instance of the page, this bit of code at the top disappears and the Visualforce remoting becomes unavailable because I cannot call that namespace, class and method.
I would do my visualforce remoting like this:
NAMESPACE.CONTROLLER.METHOD(param1, function(options) { // callback stuff here... });
There are no exceptions other than in the Javascript console saying:
ReferenceError: NAMESPACE is not defined
Any ideas?
Thanks
The RemoteAction method was actually part of another class. I just assumed that I would always be able to access that method from a page that has it's main controller set to something else.
In other words, VF page uses Controller A but calls a RemoteAction method in Controller B.
All you need to do is set Controller B as an extension and that method becomes permanently available.
I also made good use of Visualforce.remoting.Manager.invokeAction().
Take note guys.