أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
You will need to use Ajax in Jquery to pass the javascript variable to a php script and use it whatever you want.
Below is a declaration for Ajax() in jQuery:
You can do this using an Ajax call. Please find an example below:
<script type="text/javascript" language="javascript">
$(document).ready(function(){
// get your variable values upon some action or as per your desire. I am assuming you clicked a button to get some variable value.
$("#submit").click(function(){
var fullname = $("#fullname").val();
// Send an ajax call.
$.post("example.php", { fullname :fullname } , function( data ){
// Do something as per your logic.}, "json");
});
});
});
</script>
exmple.php<?php$fullname = $_POST['fullname'];
// Now you can use it on server side as you want.?>
There is a possibility of sending a javascript variable to php. You need to explain what exactly you are trying to do.