Is there a way to open external https urls, triggered on post submit and with post data inside Fancybox popups or similar?
I am talking about Paypal payments, for example. Clicking the "Buy Now" button, the PayPal website would open inside Fancybox and the data would be parsed using Ajax. This would i开发者_开发问答mprove the user experience, IMHO...
I tried this solution, found in another thread but it does not work...
$("#payment_form").bind("submit", function() {
$.ajax({
type : "POST",
cache : false,
url : "https://www.paypal.com/XXX/XXX",
data : $(this).serializeArray(),
success: function(data) {
$.fancybox(data);
}
});
return false;
});
<form id="payment_form"action="https://www.paypal.com/XXX/XXX" method="post">
<input type="hidden" name="yyy" value="xxxx">
<input type="hidden" name="yyy" value="xxxxxxxx">
<input class="gift-card" type="image" src="button.jpg" name="submit" alt="">
</form>
PayPal is actively enforcing the X-FRAME-OPTIONS:DENY response header, so I doubt this would work.
Note that I haven't tested it yet though, but PayPal actively discourages anyone from 'embedding' their site in any way, shape or form, so even if it works today, you can't guarantee it'll work tomorrow.
精彩评论