I want to update some javascript variables by sending some php values through POST. Can we join both of them? My website is http://www.nattyshirts.com and i am trying to make some interactive online modules.
2 Answers 2
Yes you can use ajax to communicate between client and server. Here are some examples
answered Jan 30, 2014 at 5:31
Bilal
2,6733 gold badges29 silver badges41 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
try this
<?php
$your_post_value = $_POST['your_post_var']; // get post value in your php variable
?>
<script>
var your_js_var = '<?php echo $your_post_value;?>'; // set up your js variable by php variable
</script>
answered Jan 30, 2014 at 5:32
Satish Sharma
9,6356 gold badges32 silver badges52 bronze badges
Comments
lang-php
setting up javascript variable through phpas he describe in his question content.