白鹭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);