How to call a .cfc using jQuery?
I'm trying to create and call a cold fusion component(.cfc) file and use jquery to pass my query info. Am i doing this correctly in Coldfusion7. Everytime i click the Finalize button nothing happens and I'm not sure what I'm doing wrong. How do I fix this?
The following is in form.cfm:
<script src="
http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="
http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script language="javascript" type="text/javascript">
function aalidateFunding(awardTotals){
$.ajax({
url: 'awardTotals.cfc',
data: {method: 'searchAward', grandtotal: GrandTotal},
success: function(data) {
if (isTotals == true) { alert('There is a match');} else { alert('This does not match);}
}
});
}
......etcetera
<input type="button" name="Finalize" value="Finalize" onClick="return validateFunding();"/>
This is my awardTotal.cfc.
<cfcomponent>
<cffunction name="myFunction" access="public" returntype="Query">
<cfargument name="awardTotals" type="string" required="true">
<cfquery name="searchAward" datasource="Test">
SELECT g.Code1 + g.Code2 + g.Code3 + g.Code4 AS GrandTotal
FROM Codes g
WHERE g.CodeNumber = <cfqueryparam cfsqltype="cf_sql_varchar" value="#argument.CodeNum#">
AND g.TestYear = <cfqueryparam cfsqltype="cf_sql_varchar" value="#argument.TestYear#">
AND g.SelType = <cfqueryparam cfsqltype="cf_sql_varchar" value="#argument.SelType#">
AND g.Jurisdiction = <cfqueryparam cfsqltype="cf_sql_varchar" value="#argument.SelJuris#">
</cfquery>
<cfscript>
if(arguments.awardTotals = searchAward){
return true;
} else {
return false;
}
</cfscript>
</cffunction>
</cfcomponent>