Advertisement
Guest User

carregar dados no select em ajax

a guest
Apr 4th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. $.ajax({
  4.  
  5. url: 'ajax/CarregaRamo',
  6.  
  7. datatype: 'json',
  8.  
  9. contentType: 'application/json; charset=utf-8',
  10.  
  11. type: 'POST',
  12.  
  13. success: function (json) {
  14.  
  15. ---->>> str += '<option>Todos</option>';
  16.  
  17. $(json.resultado).each(function () {
  18.  
  19. str += '<option value=' + json.id_ramo + '>' + json.nome + '</option>';
  20.  
  21. })
  22.  
  23. $('#tipo_categoria').html(str);
  24.  
  25. str = "";
  26.  
  27. $('#modaltiporamo').modal('hide');
  28.  
  29. },
  30.  
  31. error: function (error) {
  32.  
  33. }
  34.  
  35. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement