Having trouble with this code, it's not working as expected. I want to pass the value when I select an option from the dropdown menu, process the data using onChange event and display the value in the tag.
<label for="headmark" class="lbl-ui select">
<select id="headmark" name="headmark" onChange="getVal(this)">
<?php while (oci_fetch($headmark_parse)){?>
<option value="<?php echo $head_mark ?>" id="headmark">
<?php echo "$head_mark"; ?></option>
<?php } ?>
</select>
</label>
<script type="text/javascript">
function getVal(val){
$.ajax( {
type: 'POST',
url: update_fab_progress.php,
data: "&val=" + val,
success: function(data) {
alert("data");
}
} );
}
</script>
<?php
echo $_POST['val'];
?>