Now i have this code :
<!doctype html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
var x = document.getElementById("hhh");
$(x).append("<?php echo $v; ?> ");
</script>
<meta charset="utf-8">
<title>append demo</title>
<style>
div {
background: yellow;
}
</style>
</head>
<body>
<div id="hhh">I would like to say: </div>
<?php $v="Hello"; ?>
</body>
</html>
i need to call $v php variable in java script code i know that if i put java script code after php code it will work but if i need to put java script code in the head element like i do know and want to call any php variable in this case what should i do???