Following a basic logic, we make SQL
and return a json
// PHP
$retorno = array();
$sql = $pdo->prepare("SELECT * FROM tabela");
$sql->execute();
$retorno['dados'] = $sql->fetchAll();
die(json_encode($retorno));
Once we've recovered the json
, we'd have something similar to that.
[
{
"Nome": "Rafael Augusto"
},
{
"Nome": "Geo"
}
]
Now we could store the result in sessionStorage
to recover on each page.
sessionStorage.setItem('retorno', JSON.stringify(retornoPHP))
Following more or less this logic, you have your feedback and can access it from any page. Of course there are other ways to do it, but I'm giving that example.