Solved

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

Posted on 2008-10-29
1
1,009 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DNS, website, godaddy 6 84
whm high memory usage in processes 7 88
Redirect to HTTPS results in Infinite LOOP 4 113
Python - desktop use 1 32
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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