Created
July 6, 2010 11:15
-
-
Save albertoperdomo/465262 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("select#search_country_id").change(function(){ | |
$("img#spinner_city_id").show(); | |
$("select#search_city_id").disable(); | |
$.getJSON("/cities.json",{country_id: $(this).val(), ajax: 'true'}, function(j){ | |
var options = ''; | |
for (var i = 0; i < j.length; i++) { | |
options += '<option value="' + j[i]["city"]["id"] + '">' + j[i]["city"]["name"] + '</option>'; | |
} | |
$("select#search_city_id").html(options); | |
$("select#search_city_id").enable(); | |
$("img#spinner_city_id").hide(); | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment