K
K
kr_ilya2020-05-29 14:24:28
Mozilla Firefox
kr_ilya, 2020-05-29 14:24:28

Why is ajax not working in mozilla?

It works in chrome, yandex, opera, but not in mozilla. What is the problem?

$('#invest').on("click", function(){
    if(subm){
      return;
    }
    $('#invest').prop("disabled",true);
    $('#sumInv').prop("disabled",true);
    sumb = 1;
    var sum = $('#sumInv').val();
    var data = { 'plan': plan, 'sum': sum }
      	$.ajax({
      url: '/ajax/inv.php',
      type: 'POST',
      data: data,
      error: function() {
        subm = 0;
        $('#invSumErr').css({
        "display": "unset"
        });

        $('#invest').prop("disabled",false);
        $('#sumInv').prop("disabled",false);
        $('#invSumErr').text('Ошибка');
      },
      encoding: true,
      success: function(data) {
        data = jQuery.parseJSON(data);
        if(!data.error){
          $('input[name="m_orderid"]').val(data.m_orderid);
          $('input[name="m_amount"]').val(data.m_amount);
          $('input[name="m_desc"]').val(data.m_desc);
          $('input[name="m_sign"]').val(data.m_sign);
          $('#inv_form').submit();
        }else if(data.error){
          subm = 0;
          $('#invSumErr').css({
            "display": "unset"
          });
          $('#invest').prop("disabled",false);
          $('#sumInv').prop("disabled",false);

          if(data.data == 101 || data.data == 102 || data.data == 103){
            	$('#invSumErr').text('Сумма меньше минимальной');
          }else if(data.data == 111 || data.data == 112 || data.data == 113){
            	$('#invSumErr').text('Сумма больше максимальной');
          }else if(data.data == 120){
            	$('#invSumErr').text('Вы уже инвестировали в данный банк');
          }else{
            	$('#invSumErr').text('Ошибка');
          }
        }                       
      }
      });

  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kr_ilya, 2020-06-25
@kr_ilya

It was necessary to add event.preventDefault()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question