как использовать https пост-запрос в приложении appbrowser Cordova - PullRequest
0 голосов
/ 26 сентября 2018

код для преобразования тела сообщения в переменной сценария с параметрами Json

var options = {
      key: this.merchant_key,
      productinfo: this.productinfo,
      hash: this.hash,
      txnid: this.tran_id,
      amount: this.paymentAmountDisplay,
      service_provider:this.service_provider,
      surl: this.successURL,
      furl: this.failureURL,
      curl: this.cancelURL,
      firstname: this.firstname,
      email: this.email,
      phone:this.phone,
      udf1: this.owner_id,
      udf2: this.customer_number,
      udf3: this.payment_id,
      udf4: this.bill_id,
      udf5: this.cableName_display,
      udf6:this.calculatedDueAmount
  };    

 var script = 'var form = document.createElement("form");';
      script += 'var url = "https://secure.payu.in/_payment";';
      script += 'form.method="post"';
      script += 'form.setAttribute("action",url);';
     for (var data in options) {
       script += 'var hiddenField = document.createElement("input");';
       script += 'hiddenField.setAttribute("type", "hidden");';
       script += 'hiddenField.setAttribute("name","' + data +'");';
       script += 'hiddenField.setAttribute("value","' + options[data] + '");';
       script += 'form.appendChild(hiddenField);';
     }

код для преобразования тела сообщения в переменной сценария с параметрами Jason

script += 'document.body.appendChild(form)';
var ref = cordova.InAppBrowser.open('Url','_blank','location=yes');
script += 'form.submit();';

ref.addEventListener('loadstop', onLoadStopFunction);

function onLoadStopFunction(){
  console.log('onLoadstop in function',script);
   ref.executeScript({ code: script }, function() {
});
   ref.show();   
  }

Я пытаюсь передать объект Post на URL в InAppBrowser URL открывается, но содержимое тела, которое я отправляю через Url, не получает, поэтому, пожалуйста, помогите мне ...

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