I'm trying to send a POST request to a PHP server using a form. The form is filled at runtime and stored inside a .js file. I can access the form by using $('#form') anytime.
My problem is here: I have to send this form using the Cordova InAppBrowser. I'm loading the page, but I'm not able to pass the form.submit() to the InAppBrowser page.
I'm using the following code:
javascript
var ref = window.open('https://www.paypal.com/it/cgi-bin/webscr', '_blank');
ref.addEventListener('loadstop', function (event) {
ref.executeScript({
file: "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"
},
function () {
ref.executeScript({
code: "jQuery('#payform').submit();"
});
});
});
ref.show();
form
<form id="payform" action="https://www.paypal.com/it/cgi-bin/webscr" method="post" target="_self">; <input type="hidden" ... ... </form>
The page loads at the given url, but I'm not able to pass input elements. What am I doing wrong?
Thank you :)