当客户端在另一个域上时,如何获取form.submit响应?

时间:2019-09-25 19:31:29

标签: javascript php wordpress post

我已经使用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>

那么既然客户当时在另一个域上,那么我该如何接收回调?预先感谢。

0 个答案:

没有答案
相关问题