JSFiddle - React, Tailwind, and code Playground
JavaScript
$(function(){
var id_country = $(".country").val();
$.ajax({
type: "POST",
url: "select2",
data: {id_city: id_city},
success: function(data){
$(".city").html(data);
}
)};
$(".country").change(function(){
var id_country = $(".country").val();
if(id_country == 0){
}
$.ajax({
type: "POST",
url: "select2",
data: {id_city: id_city},
success: function(data){
$(".city").html(data);
}
)};
};
)};