I have JavaScript function with pass one parameter to
<script type="text/javascript">
function myfun(var1)
{
var returnVal = "<?php echo get_value(); ?>";
}
</script>
I want to pass JavaScript variable i.e. var1 to get_value();
I have JavaScript function with pass one parameter to
<script type="text/javascript">
function myfun(var1)
{
var returnVal = "<?php echo get_value(); ?>";
}
</script>
I want to pass JavaScript variable i.e. var1 to get_value();
You can't do that.
PHP is executed server-side, Javascript client-side. What that means is, the PHP code is executed before the Javascript.
However, you could use AJAX to call a PHP function from Javascript.
You can refer : how to pass the JavaScript variable to the php function