1jQuery(document).ready(function($) { 2 const resultMessage = $('#result_message'); 3 4 function displayResult(message, type) { 5 resultMessage.text(message); 6 resultMessage.removeClass('success error'); 7 resultMessage.addClass(type); 8 resultMessage.show(); 9 } 10 11 /** 12 * Limpia y oculta el mensaje de resultado. 13 */ 14 function clearResult() { 15 resultMessage.hide(); 16 resultMessage.text(''); 17 resultMessage.removeClass('success error'); 18 } 19 20 $('#btn_imeiVal').on('click', function(e) { 21 e.preventDefault(); 22 var imei = $('#form-field-imei').val(); 23 24 // 1. Validación básica de longitud (14 o 15 dÃgitos) 25 if (imei.length !== 14 && imei.length !== 15 || !/^\d+$/.test(imei)) { 26 displayResult('Por favor, ingresa un IMEI válido de 14 o 15 dÃgitos numéricos.', 'error'); 27 $('#form-field-imei').focus(); 28 return; 29 } 30 31 // 2. Bloquear UI y mostrar cargando 32 $('#btn_imeiVal').prop('disabled', true).html('Verificando... <span class="bl-loader"></span>'); 33 clearResult(); 34 35 $.ajax({ 36 type: 'POST', 37 url: my_ajax_object.ajax_url, 38 data: { 39 'action': 'imei_processor_v3', 40 'imei': imei, 41 'security': my_ajax_object.security 42 }, 43 success: function(data) { 44 if (data && data.success) { 45 // Parsea la respuesta a un objeto JSON 46 var responseData = data.response_body; 47 //console.log(data.response_body); 48 //console.log(responseData.compatibility); 49 var popupId; 50 if (responseData.compatibility === 'Compatible' && responseData.esim === 'SI') { 51 popupId = 2694; // ID del popup para dispositivo 100 compatible 52 } else if (responseData.compatibility === 'Compatible' && (responseData.esim === 'NO' || responseData.esim === 'Información no encontrada')) { 53 popupId = 2690; // ID del popup para dispositivo compatible sin eSIM 54 } else if (responseData.compatibility === 'No compatible') { 55 popupId = 2709; // ID del popup para dispositivo no compatible 56 } else if (responseData.compatibility === 'No probado' || responseData.compatibility == 'Compatibilidad desconocida') { 57 popupId = 2709; // ID del popup para dispositivo no probado 58 } else if (responseData.compatibility === false) { 59 console.log('Ingresa un IMEI válido.'); 60 return; 61 } else { 62 console.log('Estado de compatibilidad desconocido: ' + responseData.compatibility); 63 return; 64 } 65 // Muestra el popup correcto 66 // --- LLAMADA AL POPUP --- 67 if (typeof elementorProFrontend !== 'undefined' && elementorProFrontend.modules && elementorProFrontend.modules.popup) { 68 elementorProFrontend.modules.popup.showPopup({ id: popupId }); 69 } else { 70 console.error('Elementor Pro Popups module not loaded.'); 71 } 72 73 //elementorProFrontend.modules.popup.showPopup({ id: popupId }); 74 } else { 75 console.log('La respuesta de la API está vacÃa.'); 76 } 77 }, 78 error: function(jqXHR, textStatus, errorThrown) { 79 console.log("AJAX error: " + textStatus + ' : ' + errorThrown); 80 }, 81 complete: function() { 82 // Restablecer el botón 83 $('#btn_imeiVal').removeAttr('disabled').text('Verificar'); 84 $('#form-field-imei').val(''); 85 } 86 }); 87 }); 88});
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.