Ajax does not work for me in andorid 7.0

0

Today I turn to your help with this topic.

Develop a small webapp where I enter a value and through ajax send data to php and valid in my database if the data exists, returning a flag that I return to manipulate in jax fromateandolo with Jason.parse .

The issue is that in Windows and Android 4.0 it works excellent, but now I have an Android 7.0 device and it does not work, when I send the data I return the flag on the screen, it seems that the json.parse function will not work.

They could give me lights on what could be '

<head>
<title></title>
<script language="javascript" type="text/javascript">

 function vacio(cadena)
  {                                    // DECLARACION DE CONSTANTES
    var blanco = " \n\t" + String.fromCharCode(13); // blancos
                                       // DECLARACION DE VARIABLES
    var i;                             // indice en cadena
    var es_vacio;                      // cadena es vacio o no
    for(i = 0, es_vacio = true; (i < cadena.length) && es_vacio; i++) // INICIO
      es_vacio = blanco.indexOf(cadena.charAt(i)) != - 1;
    return(es_vacio);
  }

  function numerico(car)
  {                                    // DECLARACION DE CONSTANTES
    var num = "0123456789";            // caracteres numericos
    return(num.indexOf(car) != - 1);   // INICIO
  }

        function ValidaCampos(form)
  {
    if(vacio(form.LPN.value))
        alert("Favor ingresar No. de LPN");
     else return true;

    return(false);
    }
                                                   </script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script language="javascript">
$(document).ready(function() {
    $("#bultos").load("bultos.php");
// Interceptamos el evento submit
    $('#formulario').submit(function() {
    // Enviamos el formulario usando AJAX
    var porLPN = document.getElementById("LPN").value;
    var porVisor = document.getElementById("visor").value;
    var porLogin = document.getElementById("user").value;



        $.ajax({
            type: 'POST',
            url: $(this).attr('action'),
            data: $(this).serialize(),
            // Mostramos un mensaje con la respuesta de PHP
            success: function(data) {

                 var datos = JSON.parse(data);
                 console.log( datos );
                 if(datos === "F")
                 {

                     document.getElementById("lbltipAddedComment").innerHTML = 'LPN '+ porLPN +       ' NO EXIST IN THIS ORDER';
                     document.getElementById("lbltipAddedComment").style.background = "red";


                 }

                if(datos === "C")
                 {

                    alert("Este No. de LPN ya fue cargado anteriormente. Favor Revisar");
                     document.getElementById("lbltipAddedComment").innerHTML = '';
                     document.getElementById("lbltipAddedComment").style.background = "white";
                 }

                if(datos !== "F" && datos !== "C" )
                 {
                     var info = {

                         "LPN": porLPN,
                         "Visor": porVisor,
                         "Usuario": porLogin,
                         "Orden": datos

                     };

                     $.ajax({
                               url: 'UpdateLPN.php',
                               type: 'POST',
                               data: info,
                               success: function(data1) 
                                   {
                                       console.log(data1);
                                       document.getElementById("lbltipAddedComment").innerHTML = 'LPN ' + porLPN + ' UPDATE CORRECTLY';
                                 document.getElementById("lbltipAddedComment").style.background = "green";
                                        $("#bultos").load("bultos.php");
                                        var datos1 = JSON.parse(data1);

                                        if(datos1 === "T")
                                           {
                                              alert("Pedido Cargado Completamente. Aceptar para regresar"); 
                                              document.getElementById("LPN").disabled=true;
                                              document.getElementById("user").disabled=true;
                                              document.getElementById("checar").disabled=true;
                                            }
                                         //else
                                         //{
                                           //alert(datos1);
                                            //}
                                   },
                               error: function()
                                   {

                                      document.getElementById("lbltipAddedComment").innerHTML = 'ERROR UPDATE LPN ' + porLPN;
                                 document.getElementById("lbltipAddedComment").style.background = "red";
                                    }
                           });

                     }
                 }

             })
        LPN.value="";        
        return false;
    }); 
})


</script>


<center><form name='fomulario' id='formulario' method='post' autocomplete="off" action='validaLPN.php' onSubmit="return ValidaCampos(this)">
  <h2>Verifica Despacho</h2>

     </br>
    <?php
         $orden = $_SESSION['param_orden'];
         $visor = $_SESSION['param_visor'];
         $user = $_SESSION['param_login'];
if($conn) {

                                  $queryorden = "select no_despacho, cus_name from OE_DESPACHO_CONTROL_SALIDA where ord_no = '".$orden."' and no_despacho = '".$visor."' group by no_despacho, cus_name";

                                  $resultorden = sqlsrv_query($conn, $queryorden);

                                   while($row=sqlsrv_fetch_array($resultorden))
                                             {
                                       echo  "<input type='hidden'  name='visor' id='visor'  value='".$_SESSION['param_visor']."' />";

echo "<label id='lbltvisor' style=' font-size: 12pt' width='300%'>No. Visor: </label>";
     echo "<label id='lblvisor' style=' font-size: 12pt' width='300%'>".$_SESSION['param_visor']."</label>";
  echo "</br>";
    echo "<label id='lbltpedido' style=' font-size: 12pt' width='300%'>No. Pedido: </label>";
     echo "<label id='lblpedido' style=' font-size: 12pt' width='300%'>".$_SESSION['param_orden']."</label>";
        echo "</br>";
     echo "<label id='lbltcliente' style=' font-size: 12pt' width='300%'>Cliente: </label>";
     echo "<label id='lblcliente' style=' font-size: 12pt'  width='300%'>".$row['cus_name']."</label>";
         }
    }
         ?>
<p>
</br>                        


                        <label for = "bulto">No. LPN: </label>
                        <input type='text' autofocus name='LPN' id='LPN' style="border: 1px solid #A33636; padding: 2px 5px 2px 5px;"/>
    </br>
    <input type='text' name='user' id='user'  style="visibility:hidden" value='<?php echo $user ?> '/>

          </br>
  <input type='submit' name='checar' id='checar' value='Cargar' style="padding: 2px 5px 2px 5px;"> 
 </br>
     </br>
     <label id="lbltipAddedComment" style=" font-size: 18pt ; width="300%" "></label>

        </br>
         </br>
</p>


<div id = "bultos"></div>                         



  </form>


<a href="../redirect/redirect.php">Regresar...</a>

</center>


</body>
</html>'
    
asked by Ivan Cummings 10.05.2018 в 18:01
source

0 answers