I started by working with an example like below and found it quite
useful.  For my current project I am going to use ajaxCFC which I'm
liking as it does a lot of stuff and is simple to implement.

Cheers,

Sam

On 10/6/06, Kevin Aebig <[EMAIL PROTECTED]> wrote:
> Here's a painfully simple implementation. If you are comfortable in JS, than
> all this should make sense to you and if there's something you don't
> understand, send me an offlist message... watch for wrap.
>
> Usage:
> sendAjaxRequest("myurl.cfm", JSFunction, JSObjectAsParameters)
>
>
> <script type="text/javascript">
> <!--
> function GetXmlHttp() {
>   var xmlhttp = false;
>   if (window.XMLHttpRequest)
>   {
>     xmlhttp = new XMLHttpRequest()
>   }
>   else if (window.ActiveXObject)// code for IE
>   {
>     try
>     {
>       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
>     } catch (e) {
>       try
>       {
>         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
>       } catch (E) {
>         xmlhttp=false
>       }
>     }
>   }
>   return xmlhttp;
> }
>
> function sendAjaxRequest(url, statusCallback, paramsObject)
> {
>   var xmlhttp = new GetXmlHttp();
>   //now we got the XmlHttpRequest object, send the request.
>   if (xmlhttp)
>   {
>     xmlhttp.onreadystatechange = function ()
>         {
>           var functionToCall = statusCallback + '(\'\', false)';
>           //
>           if (xmlhttp && xmlhttp.readyState==4)
>           {//we got something back..
>                 if (xmlhttp.status==200)
>                 {
>                   //Return this to handle your own parsing...
>                   var responseText = xmlhttp.responseText;
>                   var response = eval(xmlhttp.responseText);
>                   //
>                   if (typeof(response) == "object") {
>                     functionToCall = statusCallback + '(response, true)';
>
>                   }
>                 } else {
>
>                   functionToCall = statusCallback + '(\'\', false)';
>                 }
>           }
>           else {
>                 functionToCall = statusCallback + '(\'\', false)';
>           }
>           eval(functionToCall);
>         }
>         // Generate parameters string
>         //
>         var sendVars = "";
>         for (var i in paramsObject) {
>                 sendVars += i+"="+escape(paramsObject[i])+"&";
>         }
>
>         // Generate and send request
>         //
>     xmlhttp.open("POST",url,true);
>         xmlhttp.setRequestHeader('Content-Type',
> 'application/x-www-form-urlencoded');
>         xmlhttp.send(sendVars);
>   }
> }
> -->
> </script>
>
> !k
>
> -----Original Message-----
> From: Jeff Small [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 06, 2006 12:59 PM
> To: CF-Talk
> Subject: Ajax and CF...*sigh*...again...
>
> I know, I know...asked about a ZILLION times...but here's all I want.
>
> 1. I'm a CF programmer who doesn't use any kind of framework (okay, please
> let's not go off on THAT tangent). I'm a formally taught CompSci grad dude
> who's been using CF now for about ten years, never messed with ASP, never
> messed with PHP, etc... I'm just 100% CF and I roll all my own.
> 2. I'm a reasonably good Javascript programmer who's done what I'd call
> "intermediate" JS, but nothing really super DOM heavy.
> 3. I'm really interested in Ajax, but I want to learn it from a "CF Coder
> who uses Dreamweaver as his main IDE" point of view.
> 4. I'd love to see just a simple site or page with an overview of the
> options for a CF programmer who wants to get into Ajax. Maybe something
> comparing the various AJAX frameworks out there, or how other CF'ers who
> don't normally use any kind of existing framework are getting into it. Maybe
> some simple tutorials to get you to that "AHA" moment...
>
> Does this sound like too much to ask? Does such a thing exist, or have I
> finally discovered a reason to blog? lol... (Jeff's experience getting into
> Ajax Blog)...
>
>
> --
> Jeff Small
> LHWH Advertising
> Myrtle Beach, SC 29577
> 843-448-1123 Ext 254
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255841
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to