Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/01/2014, 18:53
Jh0rdy
 
Fecha de Ingreso: octubre-2009
Mensajes: 39
Antigüedad: 14 años, 6 meses
Puntos: 1
Respuesta: enviar variables de javascript a php

De PHP a Javascript

Código PHP:

<?php
$variablephp 
"contenido de la variable php";
?>

<script>
var variablejs = "<?php echo $variablephp?>" ;
document.write("VariableJS = " + variablejs);
</script>

De Javascript a PHP

Código HTML:
<script>
var variablejs = "contenido de la variable javascript" ;
</script>
<?php
$variablephp = "<script> document.write(variablejs) </script>";
echo "variablephp = $variablephp";
?>