John, while someone may well spot something for you, I think it's a bit much
to ask to just dump the code and ask "what am I doing wrong?". :-)  It would
help a lot more if you told us what's not working as you'd expect. 

Indeed, that begs the question of what sort of debugging you are doing to
detect what parts of the code are working are working at all. Is it calling
your CFC in the Ajax call? You could determine that by using CFLOG or
CFTRACE (or even CFFILE) to write something from the CFC saying "I'm here".
You could even send yourself an email with CFMAIL. You could also use the
FusionDebug debugger to literally set breakpoints in the CFC and they will
fire if the CFC is called. If none of those show it being called, then you
know the issue is in the Javascript.

Or perhaps it's being called, but it's returning something other than what
your Javascript is expecting. In that case, you can consider a tool like
Fiddler or ServiceCapture, or Firebug in Firefox, to detect and show you
what stream of data is coming from the CFC server. Perhaps there's an error.
Perhaps it's including CF debugging output (in which case you'd want to turn
that off). Or it may just be returning some form of output that the
Javascript isn't expecting.

Hope any of those help. 

PS I wrote more about these in a blog entry on working with Spry, thought
the concepts apply with any Ajax caller:
http://carehart.org/blog/client/index.cfm/2006/7/13/spry4_unexpected_server_
results

/charlie
http://www.carehart.org/blog/

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, October 19, 2006 10:04 AM
To: discussion@acfug.org
Subject: [ACFUG Discuss] Ajax isn't just some guy from way back when...

ok I know I am missing a piece of the  Ajax/webservice puzzle in the below
code can anyone spot what I am doing wrong.


[BEGIN GEEKISH WRITINGS]
<script language="javascript">
function processReqChange() {
    // only if req shows "loaded"
    if (xmlhttp.readyState == 4) {
        // only if "OK"
        if (xmlhttp.status == 200) {
            // ...processing statements go here...
                        document.bob.innerHTML = xmlhttp.responseText;
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                xmlhttp.statusText);
        }
    }
}
function sendData()
{
        xmlhttp=null
        // code for Mozilla, etc.
        if (window.XMLHttpRequest)
        {
                xmlhttp=new XMLHttpRequest()
        }
        // code for IE
        else if (window.ActiveXObject)
        {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
        }
        if (xmlhttp!=null)
        {
                var frmInput = document.form.searchfield.value;
                xmlhttp.open("POST", "http://127.0.0.1/com/googlemini";,
true);
                xmlhttp.setRequestHeader("Content-Type", "text/xml;
charset=utf-8");
        
xmlhttp.setRequestHeader('SOAPAction','http://127.0.0.1/com/googlemini');
                xmlhttp.send('varQ='+'needles');
                xmlhttp.onreadystatechange = processReqChange;
  }
        else
  {
        alert("Your browser does not support XMLHTTP.")
  }
}
</script>


<form name="form" >
<input type="text" name="searchfield" /> <input type="button" name="myclick"
value="go" onclick="sendData();" /> </form> <div id="bob">

</div>
<!---
This works...
<cfscript>
myObj =
createobject("webservice","http://127.0.0.1/com/googlemini.cfc?wsdl";);
myObjVal = myObj.PostQuery("consent form",""); </cfscript> <cfdump
var="#myObjVal#" />
--->

[END GEEKISH WRITINGS]


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists Archive @
http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------






-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------



Reply via email to