简体   繁体   English

如何将 HTTP post 响应发送到重定向的网页

[英]How to send HTTP post response to redirected web page

I am trying to send my HTTP response to a new web page so that I can display the details of my response on that web page.我正在尝试将我的 HTTP 响应发送到一个新网页,以便我可以在该网页上显示我的响应的详细信息。 My javascript currently redirects the page to a new page but I can't seem to get my response passed over.我的 javascript 当前将页面重定向到一个新页面,但我似乎无法得到我的响应。

This is what my Javascript currently looks like这就是我的 Javascript 目前的样子在此处输入图片说明

What would the best way of doing this?这样做的最佳方法是什么?

In searchAnimalCharity you're performing a GET request, not a POST one.在 searchAnimalCharity 中,您执行的是 GET 请求,而不是 POST 请求。 With this in mind, we have to split this in two parts.考虑到这一点,我们必须将其分为两部分。

First one: Do a POST request sending your desired data (Javascript).第一个:做一个 POST 请求,发送你想要的数据(Javascript)。

Second one: Go to your localhost server and prepare a PHP file that gets that request and then redirects the user to the other page you want, passing with it the POST parameters.第二个:转到您的本地主机服务器并准备一个获取该请求的 PHP 文件,然后将用户重定向到您想要的其他页面,并传递 POST 参数。

You have an example here .你有一个例子here

Edit: In case you want to pass the response from the javascript requested URL to the third one, you can pass custom parameters from your PHP to that third page.编辑:如果您想将响应从 javascript 请求的 URL 传递到第三个,您可以将自定义参数从 PHP 传递到第三个页面。

Hope this helps you!希望这对你有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM