$(document).ready(function(){		
	
	$('#select-province').live('change', function() {
		if($(this).val().length != 0) {
			province = $(this).val();
			$.getJSON('/customers/get_cities_ajax',{idprov:province}, function(cities) {
				if(cities !== null) {
				  populateProvCitiesList(cities);
				}
			});		
      }
    });
});

function populateProvCitiesList(cities) {
	var options = '';
		options += '<option value="">..... Select one .....</option>'
	 
		$.each(cities, function(index, city) {
			options += '<option value="' + index + '">' + city + '</option>';
		});
		
	$('#select-city').html(options);
}