1 2 3$( ".paisPoliticas" ).on( "change", function() { 4 var paisSelect = $(this).val(); 5 var category = $(this).parents('.retailform').attr('data-category'); 6 var parent = $(this).parents('.retailform'); 7 8 9 // aqui vamos a hacer un llamado ajax para traer las provincias de este pais 10 var dataForm = ''; 11 12 13 dataForm += "&paisSelect=" + paisSelect + "&category=" + category; 14 15 // En este punto ejecutamos la consulta de ajax 16 var data = 'action=searchProvinciasPoliticas' + dataForm; 17 18 $.ajax({ 19 type: 'POST', 20 cache: false, 21 url: ajaxurl, 22 data: data, 23 dataType: 'json', 24 beforeSend: function () { 25 $(".loading").show(); 26 }, 27 success: function (response) { 28 $(".loading").hide(); 29 30 $(parent).find(".content-provincia" ).each(function() { 31 $( this ).removeClass( "hiden" ); 32 }); 33 34 if(response.dataProvincias){ 35 36 var nuevasOpcionesProvincia = [ 37 ]; 38 39 40 $.each(response.dataProvincias, function(llave, valor) { 41 nuevasOpcionesProvincia.push({value: llave, text: valor}); 42 }); 43 44 45 // $(parent).find('.selectProvincia option:not(:first)').remove(); 46 $(parent).find('.selectProvincia option').slice(2).remove(); 47 48 // Recorrer el array de opciones y agregar cada una al selector 49 $.each(nuevasOpcionesProvincia, function(index, opcion) { 50 51 $('.selectProvincia').append($('<option>', { 52 value: opcion.value, 53 text: opcion.text 54 })); 55 }); 56 57 } 58 59 if(response.dataCiudades){ 60 61 var nuevasOpcionesCiudades = [ 62 ]; 63 64 65 $.each(response.dataCiudades, function(llave, valor) { 66 nuevasOpcionesCiudades.push({value: llave, text: valor}); 67 }); 68 69 70 71 // $(parent).find('.selectCiudad option:not(:first)').remove(); 72 $(parent).find('.selectCiudad option').slice(2).remove(); 73 // Recorrer el array de opciones y agregar cada una al selector 74 $.each(nuevasOpcionesCiudades, function(index, opcion) { 75 76 $(parent).find('.selectCiudad').append($('<option>', { 77 value: opcion.value, 78 text: opcion.text 79 })); 80 }); 81 82 } 83 84 85 }, 86 error: function () { 87 $(".loading").hide(); 88 } 89 }); 90 91}); 92 93 94$( ".selectProvincia" ).on( "change", function() { 95 var paisSelect = $('.paisPoliticas').val(); 96 var category = $(this).parents('.retailform').attr('data-category'); 97 var parent = $(this).parents('.retailform'); 98 99 var provincia = $('.selectProvincia').val(); 100 101 // aqui vamos a hacer un llamado ajax para traer las provincias de este pais 102 var dataForm = ''; 103 104 105 dataForm += "&paisSelect=" + paisSelect + "&category=" + category + "&provincia=" + provincia; 106 107 // En este punto ejecutamos la consulta de ajax 108 var data = 'action=searchCiudadPoliticas' + dataForm; 109 110 $.ajax({ 111 type: 'POST', 112 cache: false, 113 url: ajaxurl, 114 data: data, 115 dataType: 'json', 116 beforeSend: function () { 117 $(".loading").show(); 118 }, 119 success: function (response) { 120 $(".loading").hide(); 121 122 $(parent).find(".content-ciudad" ).each(function() { 123 $( this ).removeClass( "hiden" ); 124 }); 125 126 127 if(response.dataCiudades){ 128 129 var nuevasOpcionesCiudades = [ 130 ]; 131 132 133 $.each(response.dataCiudades, function(llave, valor) { 134 nuevasOpcionesCiudades.push({value: llave, text: valor}); 135 }); 136 137 138 139 //$(parent).find('.selectCiudad option:not(:first)').remove(); 140 $(parent).find('.selectCiudad option').slice(2).remove(); 141 142 // Recorrer el array de opciones y agregar cada una al selector 143 $.each(nuevasOpcionesCiudades, function(index, opcion) { 144 145 $(parent).find('.selectCiudad').append($('<option>', { 146 value: opcion.value, 147 text: opcion.text 148 })); 149 }); 150 151 } 152 153 }, 154 error: function () { 155 $(".loading").hide(); 156 } 157 }); 158 159});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.