Pass data between windows

0

Good morning friends, I have the following question: can you pass data from a daughter window to a parent? I already know that you can pass data from a father to a daughter through ajax, but how do you do the opposite?

It's something like that from small to large, thank you very much ..

    
asked by Venté 21.02.2018 в 22:22
source

2 answers

1

If the window you open belongs to your same web application, use the window.opener :

  

Returns a reference to the window that opened this current window.

For example in your main window:

window.open("url_ventana_de_mi_aplicacion"); // abrimos la ventana

function asignarResultados(resultado)
{
  alert(resultado);
}

Then to send the data to the parent window from the other window would be:

<script>
 window.opener.asignarResultado("Hola desde la otra ventana");
</script>
    
answered by 22.02.2018 в 00:04
0

By variable GET with javascript

function abrirVentana() {
   window.open("ventanaNueva.php?var=data", "popupId", "location=no,menubar=no,titlebar=no,resizable=no,toolbar=no, menubar=no,width=500,height=500");  
}  

ventanaNueva.php is the page that will process your request, and var=data is the variable with your content that you will send

for example ventanaNueva.php?dia=15&mes=12

    
answered by 22.02.2018 в 00:11