I have a page 1.php and the code goes here(just a clone)
<?php
include '2.php'
?>
<script>
function rename(){
var x='renamedvalue';
}
</script>
<input type="button" onclick="return rename();">
And the page 2.php
<script>
var x ='somevalue';
</script>
I have to change the value of this variable onclick button event on page1.