Skip to content

Instantly share code, notes, and snippets.

@romulostorel
Created October 31, 2013 20:59
Show Gist options
  • Save romulostorel/7257065 to your computer and use it in GitHub Desktop.
Save romulostorel/7257065 to your computer and use it in GitHub Desktop.
(function(){
$('#demand_receiver_department').on('change', function(){
var employee = $("#demand_receiver_user");
$.getJSON('/employees.json?by_department='+$(this).val(), function(data){
employee.empty();
employee.append('<option value="">Selecione</option>');
$.each(data, function(i,item){
employee.append('<option value="' + item.id + '">' + item.name + '</option>');
});
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment