
Query Ajax POST提交数据
JavaScript code
$post("url",data,callback);
例: $post("testashx",{"uname":$("#txtuname")val(),"pwd":$("#txtpwd")val()},function(data,status){
if(status!="success"){ return; }
alert(data);
});
后台接收数据
C# code
string strUname = contextRequestParamsGet("uname");
string strPwd = contextRequestParamsGet("pwd");
if(!stringIsNullOrEmpty(strUname)&&!stringIsNullOrEmpty(strPwd))
{
//你的 *** 作
}
<script>
function goto(form)
{
var name=formusernamevalue;
var pwd=formpasswordvalue;
formaction = 'indexaspusername='+name+'&password='+pwd;
formsubmit();
}
</script>
<form method="post" name="login" id="login">
用户名:<input type="text" name="username" id="username" class="put" /><br />
密码:<input type="text" name="password" id="password" class="put" /><br />
<p style="padding-left:54px"> <input name="提交" type="submit" class="btn" value="登录" onclick="javascript:goto(documentlogin)" /></p>
</form>
用js把post转成get方式,然后到indexasp页面接收传过去的参数就可以了!
建议用FORM方法提交数据!
Form中的get和post方法,在数据传输过程中分别对应了>
参数不可能没有数名称post/get参数必须有名称,否则无法被服务器解析
例如:baiducom/a/bname=li&age=10
1baiducom是域
2a/b是路径,也称为路由路径
3name/age是get参数
4注意post参数也必须要key(即名称),不要以为使用post提交的参数就没有名称,只是默认不显示到浏览器地址栏而已
易语言如何取POST后返回的数据网址。
主要通过定义变量,然后转换数据类型得到返回的数据。
post可以通过>
json在前、后台传输时,只是个序列化后的字符串而已,前提是你要知道后台C#的object结构
json在前、后台接收后,需要类型转换成指定的 object,前台用(eval函数),后台就多样化了,一般我用NewtonsoftJsondll这个,把json字符串强制类型转换成指定的object
在本页的Page_Load事件中这样写
if(PagePreviousPage!=null){
//判断以post提交的页面是不是空的
if(PageIsCrossPagePostBack){
//如果是跨页提交
string
s=thisPreviousPageFindControl("txt")TextToString();
//这里查找以post提交的那个原页面控件ID为txt的TextBox控件为列
}
}
希望对您有用
以上就是关于怎么获取http post请求传输的数据全部的内容,包括:怎么获取http post请求传输的数据、在地址栏中如何以Post提交数据、javascript如何获取post返回的数据等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)