Created
December 23, 2010 12:38
-
-
Save benlangfeld/752910 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var countyOptionsTemplate = new EJS({text: "<option value=''></option><% for(var i=0; i<data.length; i++) { %><option value='<%= i %>'><%= data[i]['name'] %> County</option><% } %>"}); | |
var locationData = new Object(); | |
function GetScopedCounties(e) { | |
var selectedState = $('#LocationState').val(); | |
if (!selectedState) { | |
return; | |
} | |
countyOptionsTemplate.update('LocationCounty', locationData[selectedState].counties); | |
} | |
$(function() { | |
$.get("/states.json", function(data) { | |
for (var id in data) | |
locationData[data[id].state.id] = data[id].state; | |
GetScopedCounties(); | |
$('#LocationCounty').empty(); | |
}); | |
$('#LocationState').change(GetScopedCounties); | |
GetScopedPDTypes(); | |
GetScopedPDs(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment