loading values based on dropdown selection in php code example
Example: show a second dropdown based on previous dropdown selection in php
<script src="https://code.jquery.com/jquery-2.1.1.min.js"
type="text/javascript"></script>
<script>
function getState() {
var str='';
var val=document.getElementById('country-list');
for (i=0;i< val.length;i++) {
if(val[i].selected){
str += val[i].value + ',';
}
}
var str=str.slice(0,str.length -1);
$.ajax({
type: "GET",
url: "get_state.php",
data:'country_id='+str,
success: function(data){
$("#state-list").html(data);
}
});
}
</script>