Egret http request post

Example demo:

. 1          // new new HTTP request 
2          var Request = new new egret.HttpRequest ();
 . 3          
. 4          // request parameters 
. 5          var the params = "P1 = P2 = & postP1 postP2" ;
 . 6          
. 7          // send a post request 
. 8          the request.open ( "HTTP: //Helloworld/test.php " , egret.HttpMethod.POST);
 . 9          
10          // set the response header 
. 11          request.setRequestHeader (" the Content-the Type "," file application / X-WWW-form-urlencoded " );
 12 is          
13 is          / / transmission parameters 
14          request.send (the params);
 15          
16          //After the completion of the current request monitor data is returned 
. 17          request.addEventListener (egret.Event.COMPLETE, function (EVT) {
 18 is              // request to return data 
. 19               var Data = request.response;
 20 is               the console.log (Data);
 21 is          }, the this );

 

Guess you like

Origin www.cnblogs.com/cxx8181602/p/11323460.html