-
sendAndLoad .. why wont ze damn thing POST !!
Usually I just use loadVariablesNum to POST my variable data to an asp script ... which works fine ... but now I'm trying to use a </i>loadVars</i>.sendAndLoad("blahblah.asp", returnData, "POST") .. method and the damn thing will not POST any data .. I've got the script generating an email that just has a Request.Form("<i>variable</i>") (obviously to a variable that contains data) .. and it will not send me anything .. yet if change back to the loadVariablesNum .. the email will return the form data I requested.
.. which would be all cool .. but I need to use the sendAndLoad feature .. as my script is going to be returning some xml .. but I cant even get that far because it seems the data is not even being posted.
any ideas if there is a specific in using the sendAndLoad funciton that differes from the way I have used it above .. or does it simply not work at all.. thx in advance .. I am using Flash MX (v6)
-
free-webmaster-resource.com
why dont you post you code, its kinda impossible to see whats going on this way.
loadVars.sendAndLoad works always like a charm to me, but i use it together with php.
-
sorry .. heres whats happening:
// declaring objects
dataSend = new LoadVars();
dataRecieve = new XML();
// adding variable data to the LoadVars object. I also have variables of the same name
dataSend.CustomerID = "87654321";
dataSend.TotalAmount = CARTPriceTotal_inCents;
dataSend.CustomerFirstName = ConfirmFirstName
dataSend.CustomerLastName = ConfirmLastName;
dataSend.CustomerEmail = ConfirmEmail;
dataSend.sendAndLoad("myScript.asp", dataRecieve, "POST");
.. but the damn thing will not POST any data .. help!!! thx
-
Works well enough for me, although you had a typing error. If I were you, I would check the obvious stuff (is the URL there? do you have any typing errors? does your ASP page work?)
code:
// declaring objects
dataSend = new LoadVars();
dataReceive = new XML();
// adding variable data to the LoadVars object. I also have variables of the same name
dataSend.CustomerID = "87654321";
dataSend.TotalAmount = "CARTPriceTotal_inCents";
dataSend.CustomerFirstName = "ConfirmFirstName";
dataSend.CustomerLastName = "ConfirmLastName";
dataSend.CustomerEmail = "ConfirmEmail";
// Send and check what comes back
dataSend.sendAndLoad("test.asp", dataReceive, "POST");
dataReceive.onLoad = function(s) {
if (s) {
trace(this);
}
};
Where test.asp is:
code:
<%
set xmlOut = Server.CreateObject("Msxml2.DOMDocument.4.0")
xmlOut.async = false
xmlOut.appendChild xmlOut.createElement("response")
writeoutattribute xmlOut.documentElement, "Gen", cstr(now)
for each item in Request.form
writeoutsingletextnode xmlOut.documentElement, item, Request.form(item)
next
response.write(xmlOut.xml)
function writeoutsingletextnode( outputnode, nodename, nodevalue)
'trace "function writeoutsingletextnode"
outputnode.appendChild xmlOut.createElement(nodename)
outputnode.lastChild.appendChild xmlOut.createTextNode(nodevalue)
end function
function writeoutattribute( outputnode, attname, attvalue )
'trace "function writeoutattribute"
dim att
Set att = xmlOut.createAttribute(attname)
att.Value = attvalue
outputnode.setAttributeNode att
end function
%>
Last edited by AlsoGaiusCoffey; 03-29-2004 at 03:33 AM.
-
well .. i dont know whats going wrong for me .. but your example wont work for me either .. yes I'm running on server, checked every bit of code. My script is definetly working as it sends me test emails with trace values. If I use loadVariablesNum .. just to see if the script is working and receiving POSTed data it works .. yet if I change to sendAndLoad .. it will not .. I receive something like this in my email:
<b>in flash:</b>
testVar = "working!!";
(here I have the code that posts the data)
<b>in asp:</b>
Dim emailBody
emailBody = "testValue: " & Request.Form("testVar")
(then constructing an email object using the above for text in the email body)
if I use loadVariablesNum .. it will send me this:
testValue: working!!
if I use sendAndLoad .. it will not send back the form data:
testValue:
so it proves my script is working fine with one function that POST's but not another .. the URL is there..
for anyone that has got this working what version of flash are they developing in .. I am using MX (6) ..
-
The really obvious thing to check:
You are returning data to an XML object, therefore, you should be returning the data as XML it looks like you are returning it as straight raw data.
If you change "dataReceive = new XML();" to "dataReceive = new LoadVars();" you can test using the same page as your LoadVariablesNum.
My ASP sample assumes that you have installed MSXML 4.0 on your server (freely available from Microsoft, but well worth doing if you are using XML [once you get used to their ridiculously complex way of working]). My page won't work without it, but is pretty foolproof if you have it.
I am out of town all day, but am back home tomorrow. If you are still having problems, upload an ASP and FLA and I will see if there is something object.
-
thanks for the effort to help me work it out .. much!!! appreciated .. but I think I worked it out. I had the xml format streaming in ok .. it ended up being a stupid reserved words that was throwing me out and nothing at all to do with all the things I thought I was having a problem with .. thats always that way isn't it.
-
Junior Member
AlsoGaiusCoffey, you are a genius.
Hariyemadzisawira nhaka yedu! Down the SCUD and win!
I'm too lazy to read Private Messages.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|