How do I assign javascript variable to php variable? [closed]
i have a javascript variable which have some value that variable value assign to php variable how i do this thing
<script type="text/javascript">
var view = true;
var bcount=10;
var wcount=10;
var tcount=10;
</javascript>
<?php
$whitelistcount=????
?>
in this code i have no use ajax and jquery only simple javascript and core php
You could put your value into a hidden input field of a HTML form an submit it to the server, where your PHP can deal with it.
JavaScript can`t comunicate with PHP directly. There are two ways - AJAX or submitting a form populated with JavaScript.
The other way is PHP comunicating with JavaScript - PHP can generate the JavaScript code inside your HTML page.
精彩评论