白鹭http请求post


示例demo:

 1         //new http请求
 2         var request = new egret.HttpRequest();
 3         
 4         //请求参数
 5         var params = "p1=postP1&p2=postP2";
 6         
 7         //发送post请求
 8         request.open("http://Helloworld/test.php",egret.HttpMethod.POST);
 9         
10         //设置响应头
11         request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
12         
13         //发送参数
14         request.send(params);
15         
16         //监听当前请求完成后,返回数据
17         request.addEventListener(egret.Event.COMPLETE,function(evt){
18             //请求返回数据
19              var data = request.response;
20              console.log(data);
21         },this);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM