Pass data to view

Hi,

I’m on my first app and I need help
I’ve created a two pages app, main page and search page (using searchbar)
I succeeded to open, from main page, the search page and perform search queryes on It, but now I need to return a parameter from the search view to the main view, actually when I return on the main view I lose all data stored in the form view. here my code:

var app = new Framework7({
        // App root element
        root: '#app',
        // App Name
        name: 'GESlog',
        // App id
        id: 'it.artifex.geslog',
        // Enable swipe panel
        panel: {
            swipe: 'left',
        }
        },
        view: {
            stackPages: true
        },
        // Add default routes
        routes: [{
                path: '/',
                url: 'index.html',
                name: 'home',
                master: true,
                on: {
                    pageInit: function (e, page) {
//this function write some innerhtml inside the mainpage Dom
                            initDatabase(this);
                    }
                }
            },
            {
                path: '/ricerca/',
                url: 'ricerca.html',
                name: 'ricerca',
                on: {
                    pageInit: function (e, page) {
                        var searchbar = app.searchbar.create({
                            el: '.searchbar',
                            customSearch: true,
                            on: {
                                search(sb, query, previousQuery) {
                                    if (query.length >= 3) {
                                        setTimeout(function () {
                                            fetch('http://myurl/cercaprodotti.php', {
                                                method: 'post',
                                                body: query
                                            }).then(function (response) {
                                                return response.json();
                                            }).then(function (data) {
                                                let codprod;
//here I write inside search-list <ul> of search page 
                                                let resUl = document.querySelector("#_listaRisultati");
                                                resUl.innerHTML = '';
                                                if (data.length != 0) {
                                                    data.forEach(function (ele, i) {
                                                        if (ele.m_descrizione.trim() != '') {
                                                            var li = document.createElement("li");
                                                            codprod = ele.m_codmag.trim();
                                                            li.innerHTML = '<div class="item-inner"><div class="item-title"><a class="" data-codice="' + codprod + '" href="/">' + ele.m_descrizione + '</a></div></div>';
                                                            li.setAttribute("class", "item-content");
                                                            resUl.appendChild(li);
                                                        }
                                                    });
                                                } else {
                                                    resUl.innerHTML = '<li class="item-content">Nessun risultato trovato</li>';
                                                }
                                            });
                                        }, 300);
                                    } else {
                                        document.querySelector("#_listaRisultati").innerHTML = '<li class="item-content">Nessun risultato trovato</li>';
                                    }
                                },
                                clear(sb) {
                                    document.querySelector("#_listaRisultati").innerHTML = '<li class="item-content">Nessun risultato trovato</li>';
                                }
                            }
                        });
                    },
                }
            },
        ],
        // ... other parameters
    });

the problems are:
1- the main page loses all data in forms and dom (big problem)
2- how to catch data-codice data attr.

please someone could help me?
thank you

Maybe you can also provide some HTML layout of the pages you are working on. And couple of screenshot will be also helpful to get more understanding on what is happening and what you are trying to achieve