Syntax error How to pass JavaScript variables to PHP?

How to pass JavaScript variables to PHP?



You can easily get the JavaScript variable value on the same page in PHP. Try the following codeL.

<script>
   var res = "success";
</script>
<?php
   echo "<script>document.writeln(res);</script>";
?>
Updated on: 2019-07-30T22:30:21+05:30

21K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements