set a filter from a different page

@givemeawhiskey

Unfortunately it doesn’t work when i have multiple buttons. I redirects to the right page but doesn’t set the filter at all. I have the exact same code but repeated for each button but now I think I need to change the code on my 2nd page, however if i try and put them all under one ‘on ready function’ i cannot repeat the const function. as it only allows defining the regiondropdown once in each onready function. Should I change the const function to something else to allow them all uner the same onready function or keep them all separate and do something else?

I’ll show the examples again:

Page 1:

import {session} from "wix-storage";
import wixLocation from 'wix-location';

export function Africa_click(event, $w) {
 session.setItem('Africa', $w('#africatext').text);
 wixLocation.to("/volunteer-projects");
}
export function Europe_click(event, $w) {
 session.setItem('Europe', $w('#europetext').text);
 wixLocation.to("/volunteer-projects");
 }
export function Asia_click(event, $w) {
 session.setItem('Asia', $w('#asiatext').text);
 wixLocation.to("/volunteer-projects");
 }
export function Middleeast_click(event, $w) {
 session.setItem('Middle-East', $w('#middleeasttext').text);
 wixLocation.to("/volunteer-projects");
 }
export function Caribbean_click(event, $w) {
 session.setItem('Caribbean', $w('#caribbeantext').text);
 wixLocation.to("/volunteer-projects");
 }

PAGE 2:

import {session} from "wix-storage";

$w.onReady(function () {
 const regiondropdown = session.getItem('Africa');
 $w('#regiondropdown').value = regiondropdown
})

$w.onReady(function () {
 const regiondropdown = session.getItem('Europe');
 $w('#regiondropdown').value = regiondropdown
})

$w.onReady(function () {
 const regiondropdown = session.getItem('Asia');
 $w('#regiondropdown').value = regiondropdown
})

$w.onReady(function () {
 const regiondropdown = session.getItem('South-East Asia');
 $w('#regiondropdown').value = regiondropdown
})

$w.onReady(function () {
 const regiondropdown = session.getItem('Middle-East');
 $w('#regiondropdown').value = regiondropdown
})

$w.onReady(function () {
 const regiondropdown = session.getItem('Caribbean');
 $w('#regiondropdown').value = regiondropdown
})