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
A WannabeA Wannabe 

JavaScript/JQuery for reading request parameters during VisualForce navigation

I have two VF pages and Page 1 has some data which I want in Page 2, is it possible to get this data using JavaScript/JQuery? The constraint here is that the hyperlink to navigate to Page 2 is in a VisualForce template which has its own controller separate from those of both the Pages which use this template.

wt35wt35

If your pages do not share the same controller, have you considered passing the values through the URL?

 

You can easily retrieve query string parameters with:

ApexPages.currentPage().getParameters()

 

The following example shows how to use a PageReference object to retrieve a query string parameter in the current page URL. 

 

 

public class MyController {
   public Account getParam1() {
        return ApexPages.currentPage().getParameters().get('Param1')];
    }
}

 

<apex:page controller="MyController">
    <apex:pageBlock title="Retrieving Query String Parameters">
        {!param1} is the value of param1.
    </apex:pageBlock>
</apex:page>

 

You would call this page with such link:

https://mydomain.force.com/apex/MyPage?param1=someValue