Как получить ответ form.submit, когда клиент находится в другом домене? - PullRequest
0 голосов
/ 25 сентября 2019

Я создал форму, используя javascript, она работает, она переносит клиента в другой домен с некоторыми данными, проблема в том, что, когда клиент находится в другом домене, он что-то утверждает, а другой домен отправляет мне обратный вызов,но я не могу получить его, так как form.submit - это односторонняя вещь.

Я немного искал, но не смог найти никакого решения.

 <script>
 var theAlifForm, newInput1, newInput1,newInput2,newInput3,newInput4,newInput5,newInput6,newInput7;
  // Start by creating a <form>
  theAlifForm = document.createElement('form');
  theAlifForm.action = 'https://alifpay.tj/web';
  theAlifForm.method = 'post';
  // Next create the <input>s in the form and give them names and values
  newInput1 = document.createElement('input');
  newInput1.type = 'hidden';
  newInput1.name = 'token';
  newInput1.id = 'token';
  newInput1.value = "<?php echo  $token;?>";

  newInput2 = document.createElement('input');
  newInput2.type = 'hidden';
  newInput2.name = 'key';
  newInput2.id = 'key';
  newInput2.value = "<?php echo  $a->key;?>";

   newInput3 = document.createElement('input');
  newInput3.type = 'hidden';
  newInput3.name = 'callbackUrl';
  newInput3.id = 'callbackUrl';
  newInput3.value = "<?php echo $a->callbackUrl;?>";

   newInput4 = document.createElement('input');
  newInput4.type = 'hidden';
  newInput4.name = 'returnUrl';
  newInput4.id = 'returnUrl';
  newInput4.value = "<?php echo $a->returnUrl;?>";

    newInput5 = document.createElement('input');
  newInput5.type = 'hidden';
  newInput5.name = 'amount';
  newInput5.id = 'amount';
  newInput5.value = "<?php echo $a->amount;?>";

  newInput6 = document.createElement('input');
  newInput6.type = 'hidden';
  newInput6.name = 'orderId';
  newInput6.id = 'orderId';
  newInput6.value = "<?php echo $a->orderid;?>";

    newInput7 = document.createElement('input');
  newInput7.type = 'hidden';
  newInput7.name = 'info';
  newInput7.id = 'info';
  newInput7.value = "<?php echo $a->info;?>";

  // Now put everything together...
  theAlifForm.appendChild(newInput1);
  theAlifForm.appendChild(newInput2);
  theAlifForm.appendChild(newInput3);
  theAlifForm.appendChild(newInput4);
  theAlifForm.appendChild(newInput5);
  theAlifForm.appendChild(newInput6);
  theAlifForm.appendChild(newInput7);
  console.log(theAlifForm);
document.getElementById('hidden_form_container_custom').appendChild(theAlifForm);
  theAlifForm.submit();

  </script>

Так как я могу получитьобратный вызов, так как клиент находится в другом домене в этот момент?Заранее спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...