Solved

Having an ajax call return the query result from a coldFusion function call

Posted on 2008-10-29
1
1,055 Views
Last Modified: 2013-12-24
How do i define an ajax call that calls the function below and stores the result in a variable.

 This function is located in a separate file called getOfferCreatives.cfm
<cffunction name="getCreatives" output="false" returntype="query" hint="Returns a query of the Creatives">
	<cfargument name="Offer_ID" required="yes" type="numeric" hint="The offer ID of the items to return">
		<cfset var OCreatives="">
		<cfquery datasource="PP" name="getOfferCreatives">
			SELECT Creative_ID
			      ,CreativeName		   
			     -- ,CreativeFileName
			      ,CreativeDesc
			      ,CreativeNote
			      ,CreateEmployee_ID
			      ,CreateDateTime
			      ,Offer_ID
		 	FROM Creatives (nolock)
			WHERE Offer_ID = <cfqueryparam cfsqltype="cf_sql_numeric" value="#ARGUMENTS.Offer_ID#">
		</cfquery>
	<cfreturn OCreatives>
</cffunction>

Open in new window

0
Comment
Question by:onaled777
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 250 total points
ID: 22834358
You would use CFAjax Proxy to establish a connection to the cfc that contains your function
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_a-b_3.html#3983510

Then you write a javascript that insantiates the proxy object, calls the function and has a callback handler to  do whatever you need to do with the query results. There is an example at the bottom of the documentation that does exactly what you are trying to do.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question