Possible Duplicate:
How to read the post request parameters using javascript
Imagine two webpages running on different webservers.
- Page-A: Has a < form method="POST" action="http://server-b/page-b" >
- Page-B: Handles the submission of the form from Page-A
Can JavaScript running in Page-B access the input field values POSTed from Page-A?
An important constraint is that the server that delivers Page-B cannot substitute the POSTed values into Page-B. So JavaScript can only find out via DOM or other browser APIs.
The reason for this constraint is that Page-B in production requires that the field names match a certain form. However, during testing Page-B must be delivered by a different platform, one that does not support the field name format required by the production server. We cannot use the same platform as production due to licensing and other constraints. We could probably spin up another server to serve the Page-B test page, but that's a lot of work and we'd like to avoid it.
Please do not give an answer specific to a platform (PHP, Ruby, whatever). The systems involved are (essentially) proprietary.
The short answer is No. The browser is only aware of the content of Page B, not the request that accessed it.
If Page B can't be made to contain the values that were POSTed to it, then the only way for JavaScript on that page to obtain those values would be some completely other route, eg. by having the server log them and then having Page B ask the server via an AJAX request or something equally complex and fragile. Keeping all that in sync could be hard.