PDA

View Full Version : LoadVars & ASP & sendAndLoad


julianra
01-23-2003, 08:19 PM
Hi:
can anybody tell me why doesn't work.
These is the swf script:

frame 2
mensaje = new LoadVars();
respuesta = new LoadVars();
mensaje.nombre = "Lourdes";
//mensaje.sendAndLoad("http://julian/tucma/borrar/data.asp",respuesta,"POST");
//mensaje.sendAndLoad("http://www.institutoidiomas.com.ar/borrar/data.asp",respuesta,"POST");
mensaje.sendAndLoad("data.asp",respuesta,"POST");

frame 4
if (mensaje.onLoad == true){
gotoAndPlay(5);
}else{
gotoAndPlay(3);
}


frame 5
cadena = respuesta.letra;
stop();

The data.asp is:
<% @ LANGUAGE=VBScript %>
<% OPTION EXPLICIT
dim datos, dim letra
set datos = request.QueryString
if datos("nombre") <> "" then
letra = left(datos("nombre"),1)
response.Write "&letra=" + letra
%>



:confused:

thank

tg
01-23-2003, 09:15 PM
try:

mensaje = new LoadVars();
respuesta = new LoadVars();
respuesta.onLoad=function(done){
if(done){
cadena = respuesta.letra;
}
}
mensaje.nombre = "Lourdes";
//mensaje.sendAndLoad("http://julian/tucma/borrar/data.asp",respuesta,"POST");
//mensaje.sendAndLoad("http://www.institutoidiomas.com.ar/borrar/data.asp",respuesta,"POST");
mensaje.sendAndLoad("data.asp",respuesta,"POST");


asp:

<% @ LANGUAGE=VBScript %>
<% OPTION EXPLICIT
dim datos, dim letra
datos = request.form("nombre")
if datos <> "" then
letra = left(datos,1)
response.Write "&letra=" + letra
%>


my asp is a bit rusty, but i think that will work.

pichto
01-24-2003, 12:56 PM
I see a problem in your asp code :

set datos = request.QueryString

When using loadVars, the variables sent through POST method are never in the querystring collection but normally in the form collection. Sometime it fails (??) so i always use that :

datos = request("nombre")

And that works

julianra
01-24-2003, 12:57 PM
Hi:
thank you very much about your answer, your scrips works but the text field cadena shows:

"

I replaced the last line in ASP file with:

cadena = "&letra=animals"+request.Form("nombre")
response.Write cadena

and the text field cadena shows:

animals" request.Form("nombre")

not the request.form("nombre") value, can you tell me why?

Another question, when I upload on my asp server,

you can see it in

www.institutoidiomas.com.ar/borrar/ver.asp (http://www.institutoidiomas.com.ar/borrar/ver.asp)

it doesn't display anything,

is the asp file not working? :mad:


Thanks again

PD: sorry about my english, I hope you understand me

pichto
01-24-2003, 04:20 PM
It doesn't work because the "add" operator in ASp is not "+" but "&"

In your case :

cadena = "&letra=animals" & request.Form("nombre")
response.Write cadena

julianra
01-24-2003, 07:35 PM
I´m here again, I´m becaming crazy :confused:

I proof with these lines:

letra = request.form("nombre")
cadena = "&letra=animals"
Response.Write cadena & letra
Response.Write (cadena&letra)
Response.Write cadena & "letra"
Response.Write cadena & datos("nombre")
Response.Write cadena & request.form("nombre")
Response.Write cadena + request.form("nombre")
Response.Write cadena & request("nombre")
Response.Write cadena

and the results was the same

animals"

2 questions:
first: why I can't see the "nombre" variable
second: why the text field show the " in the end

thanks again and again

pichto
01-25-2003, 12:10 PM
I tried that :

letra = request("nombre")
cadena = "&letra=animals"
result = cadena & letra
Response.Write (result)

And it worked when i called the page like that : www.yourisp.com/yourpagename.asp?nombre=2