
  $(document).ready(function() {
    // when a new country is selected...
    $("#country").change(function() {
      // ...clear existing cities...
      $("#region").empty();
      $('#region').removeAttr('disabled');

      // ...and repopulate cities based on JSON data.
      $.getJSON( "/getRegions.php",
      // pass the selected country ID
        {
          country: $("#country").val()
        },
        function(data) {
        	
           $("<option>").attr("value", '')
                .text('All regions')
                .appendTo("#region");         	
        	
		  $.each(data, function(key, val) {

		
           $("<option>").attr("value", val)
                .text(val)
                .appendTo("#region"); 
    
		  });
	      
	                
        }
      );
    }); // $("#Countries").change(function() { ... });
  }); // $(document).ready(function() { ... });

