Computer Science, asked by jesusmo4980, 1 year ago

How to assign javascript variable to php variable inside the javascript

Answers

Answered by prabhushankar1771
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