白鷺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