I just want to know if sending value of a javascript to php is possible. here is the simple code of what i am trying to say.
<script language="javascript" >
var id = "data"
</script>
<?php
$getthevalueofid = var id;
?>
thanks!
I just want to know if sending value of a javascript to php is possible. here is the simple code of what i am trying to say.
<script language="javascript" >
var id = "data"
</script>
<?php
$getthevalueofid = var id;
?>
thanks!
Not the way your code sample is structured, no. PHP is a server-side language and Javascript is a client-side language. PHP is out of scope by the time any client-side script executes.
If you need to pass an object from the browser to your server you can use XMLHttpRequest (commonly referred to as AJAX).
<form> or use AJAX. There are a plethora of examples of how to do this on StackOverflow. Here is one that might get you started: stackoverflow.com/questions/5004233/jquery-ajax-post-example