Thanks Marco

After some extensive googling, I found this very useful guide on using
cfajaxproxy, which apparently, is a built-in tag in coldfusion 8:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_3.html

Ive created a very simple test page, which works fine outside of my
local farcry folder, but as soon as I move the .cfm and .cfc files to
within the farcry www folder, it says that the coldfusion component
name that I am trying to call is undefined.

The .cfm page is like this:

<cfajaxproxy cfc="proxy" jsclassname="proxy" />

<script>
        function serverTimeClick() {
                var instance = new proxy();
                instance.setCallbackHandler(serverTimeSuccess);
                instance.serverTime();
        }

        function serverTimeSuccess(result) {
                document.getElementById('output').innerHTML = result;
        }
</script>
<button name="serverTime" onClick="serverTimeClick()">Server Time</
button>
<br><br>
<div id="output"></div>

and the .cfc page is like this:

<cfcomponent>
<cffunction name="serverTime" access="remote" returntype="string">
                <cfset var local = {} />

                <cfset local.time = now() />
                <cfset local.result = dateFormat(local.time, "dd mmm yyyy") & " 
- "
& timeFormat(local.time, "hh:mm:ss") />

                <cfreturn local.result />
        </cffunction>

</cfcomponent>

when I run the .cfm page, it throws the error, however, if I create
another .cfm page which uses a regular invoke, it works fine:

<cfinvoke component="proxy" method="serverTime"
returnvariable="result">
<cfoutput>#result#</cfoutput>

Is there something within Farcry that could be conflicting with
cfajaxproxy tag ?


On Nov 19, 1:42 pm, Marco van den Oever <[EMAIL PROTECTED]>
wrote:
> Get some in a bucket, add water, and you're done! (here in the
> Netherlands ajax is a substance to clean your house etc)
>
> Ok sorry for that, i think you best have a look at:
>
> http://www.google.nl/search?q=cfajax&ie=utf-8&oe=utf-8&aq=t&rls=org.m...
>
> On Nov 19, 2:36 pm, BazD <[EMAIL PROTECTED]> wrote:
>
> > Thanks Sean.
>
> > And my next question is, how does one use AJAX :)
>
> > On Nov 19, 1:28 pm, Sean Coyne <[EMAIL PROTECTED]> wrote:
>
> > > CF is server side.  Once the link gets to the browser its just HTML.
> > > The browser cant execute ColdFusion.  Now, that said, you can do an
> > > AJAX call to a CFC or a CFM page and return data.  This actually
> > > generates another request to the CF server which returns HTML, XML,
> > > JSON, etc to the browser.
>
> > > Sean
>
> > > On Nov 19, 8:21 am, BazD <[EMAIL PROTECTED]> wrote:
>
> > > > Hi folks
>
> > > > Does anyone know to trigger a coldfusion function from within <a
> > > > href=""></a> ?
>
> > > > What I have at the moment is a simple test script, but all this does
> > > > is display "hello" when the page has loaded and not when the link has
> > > > been clicked:
>
> > > > <cfscript>
> > > > function test() {
> > > > writeOutput("hello");}
>
> > > > writeOutput("<a href='##' onClick='#test()#'>click here</a>");
> > > > </cfscript>
>
> > > > What I want to create is a simple link on a page which triggers a
> > > > coldfusion function. This all has to happen within the same page as
> > > > the client dosnt want to jump from page to page.
>
> > > > Im new to coldfusion components and stuff, not sure if they are they
> > > > way to achieve the results I need.
>
> > > > Any help much appreciated
>
> > > > Thanks
> > > > B
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to