I'm trying to understand how to use JSONutil to serialize/deserialize JSON between jquery and coldfusion. I am stuck with coldfusion 7 so I can't use the returnformat='json'
attribute in my cfc.
client.cfc:
<cfcomponent>
<cffunction name="GetClientsByName"
returntype="query"
hint="get clients from search term">
<cfargument name="name" type="string" required="yes">
<cfquery name="GetClientsByName" datasource="#application.dsn#">
SELECT client_id, client_name
FROM Clients
WHERE client_name LIKE '%' + <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.name#"> + '%'
</cfquery>
<cfreturn GetClientsByName>
</cffunction>
</cfcomponent>
jquery ajax call:
function getClients(name){
$.ajax {
type: "post"
url: "/surveymanagement/admin/client.cfc",
dataType: "json",
data: {
method: "GetClientsByName",
name: name
},
success: function(data){
$("#here").html(data)
}
}
Now where and how do I use jsonutil to get this to work?
The site for jsonutil: http://jsonutil.riaforge.org/