Guest User

Untitled

a guest
Jan 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. // JavaScript Document
  2.  
  3. $(document).ready(function (e) {
  4.  
  5. $("#idPastor").on("change", function () {
  6.  
  7. $.ajax({
  8. url: "_scripts/_php/_validacoes/buscarDadosRedes.php",
  9. type: "POST",
  10. dataType: "json",
  11. data: {
  12. idPastor: $("#idPastor").val()
  13. },
  14. beforeSend: function() {
  15. $("#imgCarregando").css('display','block');
  16. },
  17. success: function (result) {
  18. $("#imgCarregando").css('display','none');
  19. $('#idRede').find('option').remove();
  20.  
  21. if (result == null){
  22. $("#idRede").append("<option value=>Sem Redes</option>");
  23. } else {
  24. $("#idRede").append("<option value=>Escolha a Rede</option>");
  25. result.forEach(function(option){
  26. $("#idRede").append("<option value=" + option["idRede"] + ">" + option["nome"] + "</option>")
  27. });
  28. }
  29. }
  30.  
  31. });
  32.  
  33. });
  34.  
  35.  
  36. $("#idRede").on("change", function () {
  37.  
  38. $.ajax({
  39. url: "_scripts/_php/_validacoes/buscarDadosRegioes.php",
  40. type: "POST",
  41. dataType: "json",
  42. data: {
  43. idRede: $("#idRede").val()
  44. },
  45. beforeSend: function() {
  46. $("#imgCarregando").css('display','block');
  47. },
  48. success: function (result) {
  49. $("#imgCarregando").css('display','none');
  50. $('#idRegiao').find('option').remove();
  51. if (result == null){
  52. $("#idRegiao").append("<option value=>Sem Regiões</option>");
  53. } else {
  54. $("#idRegiao").append("<option value=>Escolha a Região</option>");
  55. result.forEach(function(option){
  56. $("#idRegiao").append("<option value=" + option["idRegiao"] + ">" + option["nome"] + "</option>")
  57. });
  58. }
  59. }
  60.  
  61. });
  62.  
  63. });
  64.  
  65.  
  66. $("#idRegiao").on("change", function () {
  67.  
  68.  
  69. $.ajax({
  70. url: "_scripts/_php/_validacoes/buscarDadosAreas.php",
  71. type: "POST",
  72. dataType: "json",
  73. data: {
  74. idRegiao: $("#idRegiao").val()
  75. },
  76. beforeSend: function() {
  77. $("#imgCarregando").css('display','block');
  78. },
  79. success: function (result) {
  80. $("#imgCarregando").css('display','none');
  81. $('#idArea').find('option').remove();
  82. if (result == null){
  83. $("#idArea").append("<option value=>Sem Áreas</option>");
  84. } else {
  85. $("#idArea").append("<option value=>Escolha a Área</option>");
  86. result.forEach(function(option){
  87. $("#idArea").append("<option value=" + option["idArea"] + ">" + option["nome"] + "</option>")
  88. });
  89. }
  90. }
  91.  
  92. });
  93.  
  94. });
  95.  
  96.  
  97. $("#idArea").on("change", function () {
  98.  
  99.  
  100. $.ajax({
  101. url: "_scripts/_php/_validacoes/buscarDadosSetores.php",
  102. type: "POST",
  103. dataType: "json",
  104. data: {
  105. idArea: $("#idArea").val()
  106. },
  107. beforeSend: function() {
  108. $("#imgCarregando").css('display','block');
  109. },
  110. success: function (result) {
  111. $("#imgCarregando").css('display','none');
  112. $('#idSetor').find('option').remove();
  113. if (result == null){
  114. $("#idSetor").append("<option value=>Sem Setores</option>");
  115. } else {
  116. $("#idSetor").append("<option value=>Escolha a Setor</option>");
  117. result.forEach(function(option){
  118. $("#idSetor").append("<option value=" + option["idSetor"] + ">" + option["nome"] + "</option>")
  119. });
  120. }
  121. }
  122.  
  123. });
  124.  
  125. });
  126.  
  127.  
  128. $("#idSetor").on("change", function () {
  129.  
  130.  
  131. $.ajax({
  132. url: "_scripts/_php/_validacoes/buscarDadosCelulas.php",
  133. type: "POST",
  134. dataType: "json",
  135. data: {
  136. idSetor: $("#idSetor").val()
  137. },
  138. beforeSend: function() {
  139. $("#imgCarregando").css('display','block');
  140. },
  141. success: function (result) {
  142. $("#imgCarregando").css('display','none');
  143. $('#idCelula').find('option').remove();
  144. if (result == null){
  145. $("#idCelula").append("<option value=>Sem Celulas</option>");
  146. } else {
  147. $("#idCelula").append("<option value=>Escolha a Célula</option>");
  148. result.forEach(function(option){
  149. $("#idCelula").append("<option value=" + option["idCelula"] + ">" + option["nome"] + "</option>")
  150. });
  151. }
  152. }
  153.  
  154. });
  155.  
  156. });
  157.  
  158.  
  159. });
Add Comment
Please, Sign In to add comment