如何在不使用PHP和Javascript的情况下将数据从一个页面传递到另一个页面?

时间:2022-05-18 21:09:53

How can I pass data from one page to another page in PHP using Javascript without from?

如何使用Javascript在PHP中将数据从一个页面传递到另一个页面?

In my blog have a post comment with email Id and this is routing using foreach loop problem occur when get email id and comment how can i do this? plz help

在我的博客中有一个帖子评论与电子邮件ID,这是路由使用foreach循环问题发生时获取电子邮件ID和评论我怎么能这样做?请帮助

3 个解决方案

#1


you can make use of client side cookie for this. one page you create cookie and on second page read that cookie.

你可以使用客户端cookie。您创建cookie的一个页面和第二页上读取该cookie。

#2


I guess that what you dislike with forms is the page reloading on the client side. If that is the case then you can use ajax requests (maybe with the help of a framework like jQuery, or pure javascript with the xmlHTTPRequest()).

我猜你不喜欢表单的是客户端页面重新加载。如果是这种情况,那么你可以使用ajax请求(可能借助于像jQuery这样的框架,或者使用xmlHTTPRequest()的纯javascript)。

Alternatively you can use cookies, but it's not what they really are for.

或者你可以使用cookies,但它不是真正的用途。

If you don't mind the page reloading, you can also use HTTP GET requests with javascript :

如果你不介意重新加载页面,你也可以使用javascript的HTTP GET请求:

location.assign("http://www.my_site.com/index.php?param1=value1&param2=value2");

#3


You can also store data in Web storage if the data doesn't necessarily need to be processed in PHP.

如果数据不一定需要在PHP中处理,您还可以将数据存储在Web存储中。

You will need to have a backup system in cookies though for the older browsers that do not support his.

对于不支持他的旧版浏览器,您需要在cookie中使用备份系统。

#1


you can make use of client side cookie for this. one page you create cookie and on second page read that cookie.

你可以使用客户端cookie。您创建cookie的一个页面和第二页上读取该cookie。

#2


I guess that what you dislike with forms is the page reloading on the client side. If that is the case then you can use ajax requests (maybe with the help of a framework like jQuery, or pure javascript with the xmlHTTPRequest()).

我猜你不喜欢表单的是客户端页面重新加载。如果是这种情况,那么你可以使用ajax请求(可能借助于像jQuery这样的框架,或者使用xmlHTTPRequest()的纯javascript)。

Alternatively you can use cookies, but it's not what they really are for.

或者你可以使用cookies,但它不是真正的用途。

If you don't mind the page reloading, you can also use HTTP GET requests with javascript :

如果你不介意重新加载页面,你也可以使用javascript的HTTP GET请求:

location.assign("http://www.my_site.com/index.php?param1=value1&param2=value2");

#3


You can also store data in Web storage if the data doesn't necessarily need to be processed in PHP.

如果数据不一定需要在PHP中处理,您还可以将数据存储在Web存储中。

You will need to have a backup system in cookies though for the older browsers that do not support his.

对于不支持他的旧版浏览器,您需要在cookie中使用备份系统。