I'am new in javascript. This question is for improve my understanding about javascript. Passing variable maybe easy if page is loaded using get or post or request function. How about passing variable between php and javascript without loading the page? Let say i have this code
<body>
<input type='hidden' name='textOption' id='mytext' /><br/>
<?php
// Get the value from <input type=hidden ....> from javascript to set as other variable
// For example but not logic
// $variableFromJS = document.getElementById('textOption').value;
?>
<select id="optionValue">
<option value='none'>--Select--</option>
<option value="first">First</option>
<option value="second">Second</option>
<option value="third">Third</option>
</select>
<script type="text/javascript">
var optionValue = document.getElementById('optionValue');
optionValue.onchange = function() {
document.getElementById('textOption').value = optionValue.value;
}
</script>
</body>