2016-11-19 3 views
0

In meinem Code ist die $ vl var leer. Warum?übergeben var jfrom JS zu PHP

JS;

<script> 
    $(document).ready(function(e) { 
    var vl = "ciao"; 

    }); 
    </script> 

PHP:

<?PHP 
    $vl= "<script>document.write(vl); </script>"; 
    echo "bariabile: ".$vl; 
    ?> 
+0

Mögliche Duplikat [Pass Wert von Javascript PHP] (http://stackoverflow.com/questions/19327607/pass-value-from-javascript-zu-php) –

Antwort

1

Dieses einfach nicht funktionieren, versuchen Sie ein paar Tutorials und Referenzen sowohl für PHP und Javascript zu lesen.

0

Gelöst:

Hs:

<script> 
    $(document).ready(function(e) { 
    var vl = "ciao"; 
    window.location.href = "TEST_YT.php?nm=" +vl; 

    }); 
    </script> 

PHP:

?PHP 
$vl= "<script>document.write(vl); </script>"; 
echo "bariabile: ".$_GET['nm']; 
?>