Flash:Actionscript 3.0 my code not posts data to url

Discussion in 'Programming' started by trecords, Aug 6, 2012.

  1. #1
    Hi,

    Please check my code why do it not posts to showed url. I have added some demo data in "postData" for to debug to see if it can post them correctly.
    My Code:
    function post_results(userid,session,score) {
    	// Post data to database
    	var loader:URLLoader = new URLLoader(); 
    	var req:URLRequest = new URLRequest("http://example.com/post.php");
    
    	req.method = URLRequestMethod.POST;
    
    	var postData:URLVariables = new URLVariables();
    	postData.uid = "000023542543";
    	postData.ses = "w6r4gt46wrtg4w3trg1ew3rt5h465tw";
    	postData.scr = "5868"; 
    	
    	req.data = postData; 
    	try {
    		loader.load(req);
    		trace("Data Sent");
    	} catch (error:Error) {
    		trace("Unable to load requested document.");
    	}  
    
    } 
    PHP:
    Turkel.
     
    trecords, Aug 6, 2012 IP
  2. giangfx

    giangfx Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why you did not add listener Event.Complete to URLLoader to check if your code work or not ?
     
    giangfx, Aug 30, 2012 IP