How to redirect data to another javascript

1

I tell you, I have a calendar project, calendar, so that it is "indexed" in a body_agenda.php file, which determines some higher buttons that if you press one you pass to the calendar for weeks, if you press another one to the days ...

Well, what I want is that by pressing a day of the calendar for weeks, take me to the calendar for days and show me the day I clicked.

The calendar for weeks is a php, the calendar for days is another php, and they are linked so to speak by a js. What I do not know is how to make the press pass that, because with what I have, it takes me to pordias.php, but of course, I do not want to change the page, I want it to stay on the same page using the js. What I was trying is the following:

function guardardia(dia, anio, mes){
    var fecha = "El dia es: "+dia+ " El mes: "+mes+" El año: "+anio;
    location.href ="javascript:select_pordias()"; //No se si es correcto
    localStorage.setItem('fecha', JSON.stringify(fecha));

}
function recogerdia(){
    var fecha = localStorage.getItem('fecha');
    document.getElementById('fecha').innerHTML = fecha;
}

And then on the php pordias page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body onload="recogerdia()">
    <div id="fecha"></div>
</body>
<script src="js/semanal.js"></script>
</html>

But it takes me to javascript pordias, but it goes blank ... I do not get the info. That's why I do not know if location.href to a javascript is correct. Thanks for your help

    
asked by Joume Parra 09.06.2018 в 17:18
source

0 answers