There is a xyz dropdown on the basis if this I am hitting AJAX get data but the response data I got in console but the data is not rendering in front view dropdown.
Here is my html and php code. I got the value it's just not showing in front view:
<tr>
<td class="style2"> District </td>
<td><select name= "district" id="district_response" class="span6 chzn-select" >
<option value="">Select District</option>
</select></td>
</tr>
PHP code
<?php $con = mysqli_connect("hostname","username","password","DBname") or die (mysql_error());
$sname = $_POST['state_select'];
$sq = "SELECT distinct(bank_district) FROM bank_all whereb ank_state ='".$_POST['state_select']."' order BY bank_district ASC";
$result1 = mysqli_query($con,$sq) or die('Error'.mysqli_error());
$resul1="";
while($row=mysqli_fetch_assoc($result1)){$resul1.= "<option value ='{$row["bank_district"]}' >{$row["bank_district"]}</option>";}echo $resul1;?>
function jsFunction(){
var myselect = $('#state_response').val();
jQuery.ajax({
url: "districtajax.php",
global: false,
type: "POST",
data: ({
state_select:myselect,
}),
dataType: "html",
async: false,
success: function (msg) {
console.log(msg);
//return false;
$('#district_response').html(msg);
}
});
}
</script>