Skip to content

Instantly share code, notes, and snippets.

@felipebastosweb
Last active April 4, 2016 13:33
Show Gist options
  • Select an option

  • Save felipebastosweb/dc2e19528b0c92f222e2a9a7c1f6689e to your computer and use it in GitHub Desktop.

Select an option

Save felipebastosweb/dc2e19528b0c92f222e2a9a7c1f6689e to your computer and use it in GitHub Desktop.
ModelView em Javascript + jQuery para preencher comboBox gerado pelo Grails
var Escola = function(){
this.fillSelect = function(){
$.get('/escola/index.json', {}, function(data){
$.each(data, function(index, escola){
$("#escola-id").append('<option value="'+escola.id+'">'+escola.nome+'</option>');
});
}, "json");
};
};
$(document).ready(function(){
var escola = new Escola;
escola.fillSelect();
var curso = new Curso;
curso.fillSelect();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment