To build on what Kier pointed out:
<cfajaxproxy jsclassname="jsEmail" cfc="ajax.email">
<script>
objEmail = new jsEmail;
objEmail.setCallbackHandler(handleEmailResponse);
//set emailId somehow
emailId = document.getElementById('emailId');
objEmail.updateEmail(emailId);
handleEmailResponse = function (email) {
// note that email.DATA comes from your CFC, based on what your return value
in your CFC is (for all variables or just complex ones? is a string
email.DATA or just email? hmmm...)
// do some stuff here...
}
</script>
Note that if you don't need it to be asynchronous, you can just eliminate
the callback handler and just act on your objEmail.updateEmail() call, such
as:
emailAddress=objEmail.updateEmail(emailId);
alert(emailAddress); // assumes a simple string returned by CFC
Billy Cravens
On Thu, Nov 5, 2009 at 12:45 PM, Kier Simmons <[email protected]>wrote:
> If you have CF8 you can use coldfusion components instead with
> cfajaxproxy.
> http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_i_01.html
>
>
>
>
>
>
> Kier Simmons
> Manager of Application Development
> [image:
> http://www.giveblood.org/email/graphics/cfl_logo.gif]<http://www.giveblood.org/>
>
> Phone:
>
> 713-791-6619
>
> Toll Free:
>
> 1-888-482-5663
>
> Fax:
>
> 713-791-6681
>
> www.giveblood.org
>
>
> P Please consider the environment before printing this e-mail.
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Mark Davis
> *Sent:* Thursday, November 05, 2009 11:58 AM
> *To:* [email protected]
> *Subject:* [Possible SPAM] [houcfug] Ajax question
> *Importance:* Low
>
>
>
> Not sure why I am not finding this..... I have several pages where we have
> a form and submit it and do something via ajax.
>
>
>
> something like this...
>
>
>
> function handleEmailUpdate(emailID) {
>
> ColdFusion.Ajax.submitForm('emailUpdateForm'+emailID,
> 'ajax/email/processEmail.cfm',handleEmailResponse);
>
> }
>
> I don't want to have a form on my current page, but I just want to do
> something like this...
>
>
>
> function handleEmailUpdate(emailID) {
>
> var ajaxURL = 'ajax/email/updateEmail.cfm?emailID=',
>
> Now just go hit this url and the return is still handled by the
> handleEmailResponse (ajaxURL,handleEmailResponse);
>
> }
>
> am I just being stupid?
>
>
>
> Thanks
>
>
>
> Mark
>
>
>
>
> ------------------------------
> This e-mail message and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity to which
> they are addressed. If you are not the intended recipient or an
> authorized representative of the intended recipient, you are hereby
> notified
> that any review, dissemination, or copying of this message and its
> attachments or the information contained herein is prohibited. If you have
> received this message in error, please notify the sender by return
> e-mail and delete this e-mail message from your computer. Thank you.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Houston ColdFusion
Users' Group" discussion list.
To unsubscribe, send email to [email protected]
For more options, visit http://groups.google.com/group/houcfug?hl=en
-~----------~----~----~----~------~----~------~--~---