How to send the data back to page that I got it from?

I have a question regarding sending data back to the page that I got it from by using router… I got a feeling that it might not be right, and it might be right at the same time… but in the end it is not working…

I sent those values (basicMoney, switchTop, switchDown, lowerPercent, minPrice1, maxPrice1, avgPrice1)
by making it as a serializable variable, randomValueCal, from “home” page to “random” page

function goToRandomNumberPage(arg) {

var minPrice1 = minPrice.value;
	var maxPrice1 = maxPrice.value;
	var avgPrice1 = avgPrice.value; 
	var randomValueCal = {basicMoney, switchTop, switchDown, lowerPercent, minPrice1, maxPrice1, avgPrice1};
        router.push("random", {"randomValueCal": randomValueCal});

and I fetch those data from “random” page with

var randomValueCal = this.Parameter;
var basicMoney = {
	return x.randomValueCal.basicMoney;

I tried to send basicMoney and lowerPercent value back to “home” page from “random” page by using router…

function goBack() {

	var basicMoney1 = basicMoney.value;
	var lowerPercent1 = lowerPercent.value;

	var arrayOfData = {basicMoney1, lowerPercent1};
	router.push("home", {"arrayOfData": arrayOfData});

Finally this is how I tried to fetch data from “random” page from “home” page…
but somehow it keeps saying that ValueFromRandomPage is undefined…

var tempValueFromRandomPage = this.Parameter;
var ValueFromRandomPage = {
	return x.arrayOfData.basicMoney1.value;

console.log("ValueFromRandomPage has value: " + ValueFromRandomPage.value);

What am I doing wrong??

Thank you for your help and interest as always!!


Its very hard to understand your problem from your code. Also, please make sure you format it correctly using markdown syntax: surround your code blocks with three back ticks




Also, note that when you use router.push, you just keep pushing more pages onto the “history stack”. This is probably not what your want. If you just want to move back to your main page, you should use router.goto instead.

If this information is not enough, please try to explain your goal in a bit more detail. Perhaps also share your project files if possible :slight_smile:

Good luck!