从jquery或javascript中的表单发布读取值 [英] read values from form post in jquery or javascript

查看:66
本文介绍了从jquery或javascript中的表单发布读取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,当提交到另一个站点的登录页面并验证身份后,用户被重定向回我的站点,我收到的帖子值为:TOKEN和地址信息。

i have a form which when submitted goes to login page of another site and After the authentication is verified, the user is redirected back to my site and i receive from post values of: TOKEN and Address information.

我想在登录后重定向的页面上发送TOKEN和地址信息。如何通过jquery或javascript获取这些值。

I want to get the TOKEN and address information sent in post on the page to which i am redirected after login. How can i get those values through jquery or javascript.

推荐答案

POST值不适用于jQuery或Javascript,因为服务器表单提交后不会将它们发送回客户端。您需要使用服务器端代码在页面中回显它们,例如在PHP中:

The POST values are not available to jQuery or Javascript, because the server does not send them back to the client after the form is submitted. You need to echo them in your page using a server-side code, for example in PHP :

var $_POST = <?php echo json_encode($_POST); ?>;

然后你就可以使用$ _POST。

Then you'll be able to use $_POST.

这篇关于从jquery或javascript中的表单发布读取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆