On a fairly major PHP/Drupal website (this is not a Drupal question) we have the task of allowing a deeplink into a page where lots of data must be provided by the calling site.
Cross-domain won't be an issue as we control both ends and can adapt as needed.
So what we want is that clicking Submit for a form on the originating server [A] will send the POST data to the receiving server [B]. That's the easy bit.
The complexity comes because there is a ton of non-user data that must be sent as well (doesn't matter why or where it comes from). So (i) there's additional data to be added to the POST payload, and (ii) the originating server [A] is node.js and they want to send JSON-encoded data and not use form-urlencoded.
And they (the JS guys) want to do it in one jump. User clicks the form on [A], they build the payload, POST to the deeplink URL and the browser displays the new page from [B].
I can handle it at the PHP end, but I can't get my head around it conceptually. I don't think it's possible.
As I understand it, the form action URL is the key. It's this that redirects the browser, sending the form-urlencoded data either in the URL or in the body. (Can't do it as JSON as we know.)
But it seems to me that if they do anything to interrupt the handling of the form on [A] the browser won't be redirected to [B] and it just becomes an AJAX call.
So the question is: Is it possible to modify the payload of a form and still get the same behaviour, redirecting the browser to the new page?
(The solution, if this is impossible, is relatively simple, an AJAX call to set everything up, which returns a URL, redirect the browser to the supplied URL.)