How to assign javascript variable to php variable inside the javascript
Answers
Answered by
1
Answer:
I have declared a javascript variable ,
var myJavascriptVar = 12345;
And unable to assign that value to php variable;
$myPhpVar = 'myJavascriptVar';
I know Ajax may be the solution of my problem. But i don't know how to use Ajax and solve the problem.
<html> <body> <script> var myJavascriptVar = 12345; <?php $myPhpVar='myJavascriptVar';?> </script> <?php echo $myPhpVar; ?> </body> </html>
Similar questions