Answers for "show a second dropdown based on previous dropdown selection in php"

PHP
0

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>
Posted by: Guest on November-28-2020

Code answers related to "show a second dropdown based on previous dropdown selection in php"

Browse Popular Code Answers by Language