| Ultrashock Forums
• LoadVars & CGI question |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
|
2003-03-04
#2 |
||
|
Post your sendAndLoad code.
|
|
|
|
2003-03-04
#3 |
||
|
my code
Here's my test code (Main TimeLine). Note that the values being returned are being decoded into properties of my dataReceiver object - but the values are wrong i.e. they are not being decoded properly. Thanks for any help... ** dataSender = new LoadVars(); //dataSender.contentType = "html/text"; dataReceiver = new LoadVars(); //dataReceiver.contentType = "html/text"; dataReceiver.onLoad = function(success){ if (success){ trace(dataReceiver.toString()); trace(dataReceiver.contentType); trace(dataReceiver.OptionValue); } else { trace("Call to CGI script Failed"); } } CalcButton.onPress = function(){ dataSender.num1 = 50; dataSender.num2 = 50; dataSender.num3 = 10; ... dataSender.sendAndLoad("http://<servername>/scripts/myscript.cgi",dataReceiver,"POST"); } |
|
|
2003-03-04
#4 |
||
|
Code:
htmlText Code:
html/text |
|
|
2003-03-04
#5 |
||
|
Try this: Replace x and y with your name pairs. Code:
trace(dataReceiver.decode("x=10&y=20"));
trace(dataReceiver.y);
|
|
|
|
2003-03-04
#6 |
||
|
Bug or Plain Weird ?
Pedalspeed, First, thanks for your help - I really appreciate your time to respond to my post. I solved my problem: It turns out that the LoadVars variables being sent to the server are being sent in the reverse order to which they were defined in my code!! my code: dataSender.Num1=50; dataSender.Num2=10; dataSender.Num3=33; results in the following string being sent to the server: "Num3=33&Num2=10&Num1=50" Because my CGI script identifies name/value pairs by their order and not their name, the wrong input was being processed. I'm not familiar enough with CGI script coding 'best practices' in general to come to any definite conclusions - but I'd say this is more likely a bug than a feature ?! Bernard. |
|
|
2003-03-04
#7 |
||
|
Changing Code:
dataSender.Num3 = numA; dataSender.Num2 = numB; dataSender.Num1 = numC; Code:
dataSender.Num1 = numA; dataSender.Num2 = numB; dataSender.Num3 = numC; |
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


?
6 comments
| 166 views


Linear Mode