码迷,mamicode.com
首页 > 其他好文 > 详细

不传参数名获取参数(前、后台代码)

时间:2016-11-04 16:32:19      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:style   type   code   cat   test   for   stream   input   bsp   

js

  var xhr = new XMLHttpRequest();
        xhr.open("post", "/Home/NoParamTest", true);
        //两种协议都可以
        xhr.setRequestHeader("Content-Type", "application/json");
        //xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.send(JSON.stringify({ a: 1, b: 2, c: 3 }));

c#后台

 public void NoParamTest()
        {            
            using (StreamReader sr = new StreamReader(Request.InputStream))
            {
         //data就是前面传过来的数据
string data = sr.ReadLine(); } }

 

不传参数名获取参数(前、后台代码)

标签:style   type   code   cat   test   for   stream   input   bsp   

原文地址:http://www.cnblogs.com/myesn/p/6030507.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!