I have a select element which has values of sequences in a database:
<option value="1">one</option>
<option value="2">two</option>
I then have this PHP code which puts the table data into an array
<?php
$return_arr = array();
$sql="SELECT * from tickets_standardresponses ";
$rs=mysql_query($sql,$conn) or die(mysql_error());
while($result=mysql_fetch_array($rs)) {
$return_arr[] = array('sequence' => $result["sequence"], 'response' => $result["response"]);
}
$data = json_encode($return_arr);
?>
<script type="text/javascript">
$(document).ready(function(){
var data = <?php echo $data; ?>;
$('#standard_response').on('change',function() {
});
});
</script>
How can I fill a textarea
based on the selected option
For example, if the selected option's value = 1 i want to put the response data from the array where the sequence = 1
I do not want to use GET/POST requests using Ajax