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
Ashutosh Limaye 8Ashutosh Limaye 8 

Page Reference getContent() method behaving differently when invoked from a JS controller.

Hi,
I have a server side controller which is creating a PageReference object to a page and then calling getContent().toString() on it. This works fine when the method is called from Anynonymous block. The HTML for the desired page is returned in String format.
But when I call this Apex controller's method from the Client side JS controller, the content that is returned is different. 
I read that the getContent() method is a callback method and I believe that the method call from the javascript controller is also asynchronous.Could it be that the javascript call back is not waiting long enough for the getContent() to return with the complete HTML?