Created
August 21, 2015 08:14
-
-
Save iledcom/03495a37002c6e869af5 to your computer and use it in GitHub Desktop.
From JavaScript in PHP (method GET)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var userName2 = 'Переменная'; | |
</script> | |
<?php | |
if (isset($_GET['u_name'])) | |
{ | |
echo "Значение JavaScript-переменной: ". $_GET['u_name']; | |
} | |
else | |
{ | |
echo '<script type="text/javascript">'; | |
echo 'document.location.href="' . $_SERVER['REQUEST_URI'] . '?u_name=" + userName2'; | |
echo '</script>'; | |
exit(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment