Pete,

As Sean noted in his post, the return value is encoded as a WDDX
packet. You will need to use the WDDX deserializer object to unencode
the string. In your js function that handles the data once the XMLHTTP
request has returned you can use an alert to see the raw packet, this
way you will know if your CFC is indeed returning the valid
information.


Here is some code that may be helpful:


<cfcomponent name="XMLconduit"  author="Pete Ruckelshaus"
displayname="XMLconduit" hint="This .cfc is used for all XML-returned
data for the application.">
       <cffunction name="getContactsByOrganization" access="public"
output="Yes" returntype="XML">
       <cfargument name="param" default="0" required="Yes" type="numeric">

       <cfquery name="getContacts" datasource="#request.app.dsname#">
               SELECT          C.ID, C.fname, C.lname
               FROM            tblContacts C
               WHERE           C.contactTypeID = (SELECT id FROM
tblContactTypes WHERE
typename = 'individual') AND
                                       C.organizationid =
<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.param#" />
               ORDER BY        C.fname, C.lname
       </cfquery>
<cfxml variable="xml">
                       <contactdata>
                               <cfloop query="getContacts">
                                       <id>#getContacts.id#</id>
                                      
<firstname>#getContacts.fname#</firstname>
                                       <lastname>#getContacts.lname#</lastname>
                               </cfloop>
                       </contactdata>
               </cfxml>

               <cfreturn xml />
       </cffunction>
</cfcomponent>


Javascript Code:

var isMozilla = ((document.all) ? false : true);

        
        function getXmlHttpConn()
        {
                var xhttp = null;
                try
                {
                        if (! isMozilla)
                        {
                                xhttp = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        else
                        {
                                xhttp = new XMLHttpRequest();
                        }
                }
                catch (e)
                {
                        alert("An error has occurred while attempting to get a 
connection
to the server!");
                }
                return xhttp;
        }
        
        function getRequest(method, url, async, func)
        {
                var xmlHttpConn = getXmlHttpConn();
                if (xmlHttpConn != null)
                {
                        try
                        {
                                        xmlHttpConn.open(method, url, async);
                                        xmlHttpConn.onreadystatechange = 
function() { if
(xmlHttpConn.readyState == 4) {
processRequest(xmlHttpConn.responseText, func); } }
                                        xmlHttpConn.send(null);
                        }
                        catch (e)
                        {
                                alert(e.description);
                        }                       
                }
        }
        
        
        function processRequest(rs, func)
        { 
                
                alert(rs);
                if (isMozilla)
                {
                        des = new WddxDeserializer;
                }
                else
                {
                        des = new WddxDeserializerForIE;
                }
                var xmlTextStr = des.deserialize(rs);
                if (func)
                {
                        func(xmlTextStr);
                }
        }

Please let me know if you need some more help with this.

HTH
Best Regards,


-- 
Donnie Bachan 
Website: http://www.islandwizards.com
Blog: http://angrytrini.blogspot.com
"Nitendo Vinces - By Striving You Shall Conquer" 
====================================================================== 
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged 
material. Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or 
entities other than the intended recipient is prohibited. If you received 
this in error, please contact the sender and delete the material from any 
computer.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207616
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to