if i make a variable in javascript with this script
var kakakSisa = 10;
and i wanna call it in PHP for example
<?php echo <script type="text/javascript">kakakSisa;</script> ?>
and that doesn't work!! how i can make it work?
if i make a variable in javascript with this script
var kakakSisa = 10;
and i wanna call it in PHP for example
<?php echo <script type="text/javascript">kakakSisa;</script> ?>
and that doesn't work!! how i can make it work?
You can't use javascript variable in php code. Php code run's on the serverside and javascript code runs in the client side (If you are not using Node.js). You can't ask the browser to run php code.
Your variable loc will have a value only when the code reaches the browser.
If you want to get some value from server and combine it with javascript variables then do the following.
Use an ajax request and send the desired values to server. The server will return with a response. Use that response text and store it in your action variable.