Register now or log in to join your professional community.
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.
Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.