A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: need help with loadVars

Hybrid View

  1. #1
    IT'S GON' RAIN !!! var gotMilk's Avatar
    Join Date
    Apr 2004
    Location
    Yorkshire, England, UK
    Posts
    372

    need help with loadVars

    hey,

    ive got a project where i have to load 2 variables into a php script, ive tried a few ways but none seem to work.

    what i need to do is basically call this address:
    http://www.mysite.com/script.php?db=100&at=q76
    but the 'db' and 'at' variables are what i need to load.

    i have tried this:
    Code:
    var siteUrl = "http://www.mysite.com/";
    var db = db.text;
    var at = "q76";
    
    submit.onPress = function() {
    	myData = new LoadVars();
    	myData.load(siteUrl+"script.php?db="+db.text+"&at="+at, "POST");
    	myData.onLoad = function(success) {
    		if (success) {
    			smessage.text = "Ok";
    		} else {
    			smessage.text = "Nope";
    		}
    	}
    }
    so i need it to load the 2 variables and execute the script.

    i have probably done this wrong, i hate loadvars, and im sure it hates me.
    any help would be great.

    thanks.

    Professional quality freelance work done by Varstudios
    Visit us here http://www.varstudios.com/services



  2. #2
    Junior Member
    Join Date
    Oct 2005
    Posts
    26
    Working from memory here - but doesn't LoadVars post all variables that are in the LoadVars object?

    Try putting this just below "myData = new LoadVars()":

    myData.db= db.text;
    myData.at = at.text;

    and see if it works.

  3. #3
    IT'S GON' RAIN !!! var gotMilk's Avatar
    Join Date
    Apr 2004
    Location
    Yorkshire, England, UK
    Posts
    372
    No, that doesnt work, all i need it to do is load this url http://www.mysite.com/script.php?db=100&at=q76 without actually opening a page.

    Professional quality freelance work done by Varstudios
    Visit us here http://www.varstudios.com/services



  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    myData = new LoadVars();
    myData.db= db.text;
    myData.at = "q76";
    myData.onLoad = function(){
    trace(unescape(this));
    };
    path = siteUrl+"script.php";
    myData.sendAndLoad(path,myData,"POST");
    hth

  5. #5
    IT'S GON' RAIN !!! var gotMilk's Avatar
    Join Date
    Apr 2004
    Location
    Yorkshire, England, UK
    Posts
    372
    thanks man.

    Professional quality freelance work done by Varstudios
    Visit us here http://www.varstudios.com/services



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center