I Have Two Dropdown State And Zipcode , When User Click On State , Zip code Loaded from Ajax . In Zip code I have Set The Function of change to get Value of zip code select option. But jquery Giving me undefined Value . Here is Complete Code.How Can I Get The Zip Code Value
<select name="sState" id="sState" onChange="LoadZipCode();">
<?php $resultState=$objGeneral->GetStates();
echo '<option value="default">select The States</option>';
while($rowState=$resultState->fetch_array(MYSQLI_BOTH))
{
echo '<option value="'.$rowState[2].'">'.$rowState[1].'</option>';
}
?>
</select>
<select data-live-search="true" class="form-control selectpicker" name="sZip" id="sZip" onChange="LoadCity();" required>
</select>
In Jquery Here Script For Loading Zip Code
<script>
function LoadZipCode()
{
var StateAbbre=$("#sState").val();
$.post("DashboardProcess.php?action=getZipCode",{StateAbbr:StateAbbre},function(data)
{
$("#sZip").html(data);
$('#sZip').selectpicker('refresh');
});
}
</script>
<script>
function LoadCity()
{
alert($(this).find('#zipCode option').val());
}
</script>