Error while calculating fields in IOS safari

Asked

Viewed 28 times

0

I have a problem in the development of a small calculation system where the user needs to put a value in a field and the system brings the results according to a specific account.

In all windows browsers on computers and Android works properly, however for safari on IOS the fields simply do not work. Is there any systemic compatibility on this?

Follows code:

<script>
jQuery('.simularparcela')[0].type = 'button';
jQuery(".simularparcela").click(function() {
var valorparcelas = jQuery(".valorparcela");
var parcelas = jQuery('input[name="meses[]"]:checked');
var valorparcela = valorparcelas[0].value;
var parcela = parcelas[0].value;
      jQuery.ajax({
        dataType: 'json',
        type : "POST",
        url: "http://www.mettaconsultoria.com.br/calculoparcela.php",
        data: { valorparcela: valorparcela, parcela: parcela, id: 1 },
        complete: function(result) {
        console.log(result);
          var json = JSON.parse(result.responseText);
          switch(json.code) {
            case 200:
            parcela = parcela.replace(/(d)(?=(ddd)+(?!d))/g, "$1.");
            jQuery('input[name="vlrCredito"]')[0].value = json.Credito;
            jQuery('#td_parcela_consorcio')[0].innerHTML = parcela;
            jQuery('#td_parcela_financiamento')[0].innerHTML = parcela;
            jQuery('#td_credito_consorcio')[0].innerHTML = json.Credito;
            jQuery('#td_credito_financiamento')[0].innerHTML = json.Credito;
            jQuery('#td_vlr_parcela_consorcio')[0].innerHTML = valorparcela;
        jQuery('#td_vlr_parcela_financiamento')[0].innerHTML = json.parcelaFinanciamento;
            jQuery('#td_totais_consorcio')[0].innerHTML = json.ValorSaldoDevedor;
            jQuery('#td_totais_financiamento')[0].innerHTML = json.financiamento;
            jQuery('#td_economia')[0].innerHTML = json.diferenca;
            jQuery('#comple_tabela')[0].hidden = false;
            jQuery('#tabela')[0].hidden = false;
            jQuery('.oculta').css("display","");
            jQuery('.info').css('display','');
            break;
            case 400:
            $(".overlap").hide();
            alert(json.msg);
            break;
          }
        }
      });
});
jQuery('.simular')[0].type = 'button';
jQuery(".simular").click(function() {
var creditos = jQuery(".credito");
var parcelas = jQuery('input[name="meses[]"]:checked');
var credito = creditos[0].value;
var parcela = parcelas[0].value;
      jQuery.ajax({
        dataType: 'json',
        type : "POST",
        url: "http://www.mettaconsultoria.com.br/calculo.php",
        data: { credito: credito, parcela: parcela, id: 1 },
        complete: function(result) {
        console.log(result);
          var json = JSON.parse(result.responseText);
          switch(json.code) {
            case 200:
            credito = credito.replace(/(d)(?=(ddd)+(?!d))/g, "$1.");
            jQuery('input[name="vlrParcela"]')[0].value = json.vlrParcela;
            jQuery('#td_parcela_consorcio')[0].innerHTML = parcela;
            jQuery('#td_parcela_financiamento')[0].innerHTML = parcela;
            jQuery('#td_credito_consorcio')[0].innerHTML = credito;
            jQuery('#td_credito_financiamento')[0].innerHTML = credito;
            jQuery('#td_vlr_parcela_consorcio')[0].innerHTML = json.vlrParcela;
        jQuery('#td_vlr_parcela_financiamento')[0].innerHTML = json.parcelaFinanciamento;
            jQuery('#td_totais_consorcio')[0].innerHTML = json.vlrSaldoDevedor;
            jQuery('#td_totais_financiamento')[0].innerHTML = json.financiamento;
            jQuery('#td_economia')[0].innerHTML = json.diferenca;
            jQuery('#comple_tabela')[0].hidden = false;
            jQuery('#tabela')[0].hidden = false;
            jQuery('.oculta').css("display","");
            jQuery('.info').css('display','');
            break;
            case 400:
            $(".overlap").hide();
            alert(json.msg);
            break;
          }
        }
      });
});
</script>
  • Do they not work in the sense that they are disabled or return a specific error? Is this only in Safari for iOS or Macos as well? Safari often has a bug where it doesn’t start code in Jquery or cache, this problem is usually solved by putting the whole code inside $(function() {}) is not the most correct but resolves.

  • So, the problem happens only in IOS, whether accessed by mobile safari or google Chrome we did the tests, the error only happens on the device, windows works normally, it returns an error coming from the Ajax request page, another message programmed by someone, is not a systemic error.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.