Guest User

Untitled

a guest
Jan 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function() {
  3. $('#estadoMunicipio')
  4. .change(
  5. function() {
  6. if ($(this).val()) {
  7. $('#municipioEstado').hide();
  8. $('.carregando').show();
  9. $.getJSON('/nota-fiscal-servico-web/buscaMunicipioPorPaisEstado/' + $(this).val(),
  10. function(j) {
  11. var options = '<option value="" class="chosen-select">'
  12. +'</option>';
  13. for (var i = 0; i < j.length; i++) {
  14. options += '<option class="chosen-select" value="' +
  15. j[i].id + '">'
  16. + j[i].descricao
  17. + '</option>';
  18. }
  19. $('#municipioEstado')
  20. .html(options)
  21. .show();
  22. $('.carregando').hide();
  23. });
  24. } else {
  25. $('#municipioEstado')
  26. .html(
  27. '<option class="chosen-select" value="">-- Escolha um estado --</option>');
  28. }
  29. });
  30. });
  31. </script>
Add Comment
Please, Sign In to add comment