I need to send a post request to paypal, but before sending the form I need to verify some inputs and the paypal page must be opened in a new tab or window (doesn't matter). I can't send the request in the same window because in the main page I have background ajax callbacks. So the ideea is can I send the request in a new window or tab?
In all major browesers this isn't allowed, browser keep blocking the request.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" id="paypal_form">
<input type='hidden' name='some_value' id='some_value' value='151' />
</form>
<div id='button_submit' onClick="verify_paypal_form();">SUBMIT !</div>
And now the ajax part:
function verify_paypal_form(){
$.post('verify.php', { someValue : 'FOO' },
function(data){
if( data == 'OKAY' ) $('#paypal_form').submit();
});
}