M
M
MyName322020-05-18 21:36:06
JavaScript
MyName32, 2020-05-18 21:36:06

Ajax request is not executed on Iphone. What needs to be done with the code to open the payment page on the Iphone?

There is a code that calls the payment page, but it does not work on the Iphone, or rather in Safari. It also works if you turn off the pop-up blocker. How can this limitation be bypassed?

$(document).ready(function () {


  //$('.bb_right_inside input').attr("value", "0");




  var send_flag = 0;
  $('form[name="SIMPLE_FORM_2"]').submit(function(e){
    if(send_flag == 0){
      e.preventDefault();
      console.log('subm');
      var sum = $('input[name="form_text_100"]').val();
      $.ajax({
        type: "POST",
        url: "/ajax/kassa-ajax.php",
        data: {sum:sum},
        success: function (e) {
          window.open(e, "_blank"); 
        }
       });
       setTimeout(function(){
      send_flag = 1;
      $('.zakazat_pominovenie input').click();   
       },1500);		   
       return false;
    }
  });
  
  $('.ol_10_input.oli_1').addClass('active_ol');
  $('.button_10_plus').click(function(){
    var current = $('.bi_ozdravii .active_ol');
    current.removeClass('active_ol');
    current.next().css('display','block');
    current.next().addClass('active_ol');		
  });
  
  $('#form_checkbox_ozdravii_66').attr('checked', true);
  var priceMoney = 250;
  var namesCount = 0;
  var currentPrice = 0;
  
  $('.br_obupokoenii input').change(function (e) {
    $('.br_ozdravii input:checked').attr('checked',false);
    update_price();
  });
  
  $('.br_ozdravii input').change(function (e) {
    $('.br_obupokoenii input:checked').attr('checked',false);
    update_price();
  });

    $('.bi_ozdravii').on('keyup', 'input', function () {
        namesCount = 0;
        $('.bi_ozdravii input').each(function (e) {
            if ($(this).val() != '' && $(this).val() != ' ') {
                namesCount++;
            }
        });
        toInputDonation();
    });
    toInputDonation();
  function update_price() {
    var cb_id = $('.block_radio input:checked').val();
    if (cb_id == 66)
      priceMoney = 250;
    if (cb_id == 73)
      priceMoney = 450;
    if (cb_id == 93)
      priceMoney = 950;
    if (cb_id == 94)
      priceMoney = 10;
    if (cb_id == 95)
      priceMoney = 10;
    if (cb_id == 96)
      priceMoney = 10;
    if (cb_id == 67)
      priceMoney = 250;
    if (cb_id == 97)
      priceMoney = 450;
    if (cb_id == 98)
      priceMoney = 950;
        toInputDonation();
    };

    function toInputDonation() {
        currentPrice = namesCount * priceMoney;
    if(currentPrice == 0)
      currentPrice = 0;
    $('input[name="form_text_100"]').val(currentPrice);
    //console.log(currentPrice);
    }

    $('.block_input input').attr("placeholder", "Добавьте им в Р.п.");
    $('.bb_right_inside input').attr("type", "number");
    $('.ol_10_input').children("li").first().children("input").attr("required", "required");


  $('.br_ozdravii').click(function(){
    $(".block_input").removeClass("chernjy_block");
    $(".block_input").addClass("krasnyj_block");
  });

  $('.br_obupokoenii').click(function(){
    $(".block_input").removeClass("krasnyj_block");
    $(".block_input").addClass("chernjy_block");
  });



});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Orlov, 2020-05-18
@haveacess

Don't you think that you answered your own question?)
Get rid of pop-up windows and you will have a holiday. window.open(e, "_blank"); - here from this infection)
Here are the possible options:
Open the payment page (immediately after clicking pay). In the current tab.
After payment (successful/not successful) open the desired page. As a rule, such pages are set in the settings of your checkout, or which aggregator you use there. Well, as a plus
, data is transmitted to this page, for example, the order number. By which you can give the necessary information, of course, if necessary.
Link (button pay) - we do with the attribute form (new tab). And when you click, in the new one - the payment page, in the current one - the product you need.
P, s my options are not a guide to action, but only food for thought

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question