关于post / get的问题 [英] question about post/get

查看:69
本文介绍了关于post / get的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部


当我按照以下方式执行操作时,它将成为服务器的GET操作。如何将

作为POST操作?这意味着我不想在URL栏上显示?>

之后的字符串,并且对于服务器,它可以按照POST功能获得

数据传入。非常感谢!


window.open(" ../../ Server.php?" + xsValue,"",zNONHTML_STYLE);

杰克

Hi, all

When I do as the following, it becomes a GET action to the the server. How
do I make it as a POST action? That means I don''t want the string after "?"
show on URL bar and, to the server, it can follow POST function to get the
data passed in. Thank you very much!

window.open("../../Server.php?"+xsValue, "", zNONHTML_STYLE);
Jack

推荐答案

" q2005"写了
"q2005" wrote
当我执行以下操作时,它成为服务器的GET操作。
如何将其作为POST操作?这意味着我不希望在
"?之后输入字符串。显示在URL栏上,并且,对于服务器,它可以按照POST功能获得传入的数据
。非常感谢!

window.open(" ../ .. /Server.php?" + xsValue,"",zNONHTML_STYLE);
When I do as the following, it becomes a GET action to the the server. How do I make it as a POST action? That means I don''t want the string after "?" show on URL bar and, to the server, it can follow POST function to get the data passed in. Thank you very much!

window.open("../../Server.php?"+xsValue, "", zNONHTML_STYLE);




这是一个GET请求,是的,但只有在javascript可用的情况下。没有

javascript它什么都没有。

如果你想发布一些东西,就没有使用表格了。如果

依赖于javascript不是问题(但通常是这样),这个表单可以动态构建


var f = document.createElement(''form'');

document.body.appendChild(f);

f.action =''.. / .. / Server。 php'';

f.method =''post'';

var i = document.createElement(''input'');

f.appendChild(i);

i.type =''hidden'';

i.name =''somename'';

i.value = xsValue;

f.submit();


HTH

-

Ivo



This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can
be built dynamically:
var f=document.createElement(''form'');
document.body.appendChild(f);
f.action=''../../Server.php'';
f.method=''post'';
var i=document.createElement(''input'');
f.appendChild(i);
i.type=''hidden'';
i.name=''somename'';
i.value=xsValue;
f.submit();

HTH
--
Ivo


谢谢,伊沃。它非常有帮助。那么,在峰会之后,如何删除

表单对象?再次感谢!


Jack
Thanks, Ivo. It''s so helpful. By the way, after summit, how do I delete the
form object? Thanks again!

Jack
这是一个GET请求,是的,但只有在javascript可用的情况下。没有
javascript它什么也没有。
如果你想发布一些东西,就没有使用表单了。如果依赖于javascript不是问题(但通常是这样),这个表单可以动态构建:
var f = document.createElement(''form'');
document.body.appendChild(f);
f.action =''.. / .. / Server.php'';
f.method =''post'';
var i = document.createElement(''input'');
f.appendChild(i);
i.type =''hidden'';
i.name =' 'somename'';
i.value = xsValue;
f.submit();

HTH
-
Ivo
This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can
be built dynamically:
var f=document.createElement(''form'');
document.body.appendChild(f);
f.action=''../../Server.php'';
f.method=''post'';
var i=document.createElement(''input'');
f.appendChild(i);
i.type=''hidden'';
i.name=''somename'';
i.value=xsValue;
f.submit();

HTH
--
Ivo



" q2005"写了
"q2005" wrote
这是一个GET请求,是的,但只有在javascript可用的情况下。没有
javascript它什么也没有。
如果你想发布一些东西,就没有使用表单了。如果对javascript的依赖不是问题(但通常是这样),可以动态构建
形式:
var f = document.createElement(''form'');
document.body.appendChild(f);
f.action =''.. / .. / Server.php'';
f.method =''post'';
var i = document.createElement(''input'');
f.appendChild(i);
i.type =''hidden'';
i.name =' 'somename'';
i.value = xsValue;
f.submit();
This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can be built dynamically:
var f=document.createElement(''form'');
document.body.appendChild(f);
f.action=''../../Server.php'';
f.method=''post'';
var i=document.createElement(''input'');
f.appendChild(i);
i.type=''hidden'';
i.name=''somename'';
i.value=xsValue;
f.submit();


谢谢,伊沃。它非常有帮助。那么,在峰会之后,如何删除
表单对象?再次感谢!

Thanks, Ivo. It''s so helpful. By the way, after summit, how do I delete the form object? Thanks again!




你不是。表单已提交,因此整个页面被删除,因为

服务器响应全新页面。请注意,提供的示例代码

在使用之前不会测试功能。在

现实世界中使用它之前包括

if(document.createElement){...}之类的东西。另外,尽量避免依赖javascript。如果你能用

一个普通的形式来做,听起来就像你可以那样做。

HTH

-

Ivo



You don''t. The form is submitted, so the whole page is ''deleted'' as the
server responds with a brand new page. Note that the example code provided
does not test for features before using them. Include
if(document.createElement) {...} and stuff like that before using it in the
real world. Also, try to avoid relying on javascript. If you can do it with
an ordinary form, and it sounds like you can, then do.
HTH
--
Ivo


这篇关于关于post / get的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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