I have a form processed by PHP that redirects visitors to a third-party payment system, through the use of the Location:
header. The form is processed quickly, but when it comes to a payment system (Paypal), it takes up to 3-5 seconds to establish HTTPS connection and complete the redirection.
I'm trying to improve visitor experience by displaying a popup (JQuery Colorbox plug-in) with a "Please wait" message, like this:
$('a.submit').click(function(event) {
event.preventDefault();
$(this).colorbox({
href: '#order_redirect',
title: 'Sending data to a payment system',
inline: true,
fixed: true
});
$(this).closest('form').submit();
});
Default behavior of Colorbox is that you can press Esc
and close the popup. I want to let the user do that and stop the redirection via a callback function (Javascript continues working for the whole time). Is it possible? It may be seconds after the browser actually receives the header.