Sunday 15 January 2012

jquery - How to create a .cfc file using Ajax? -


I am trying to create a ColdFusion component (.cfc) file and use Ajax to pass my query I do Am I doing it correctly and can I use Ajax in CxX 7?

Added to the comment of OP

I have updated it once again and as I mentioned above my Button click works and my components work, but the call to the component does not do anything. Can anyone see what the problem might be, can see it another time. I think I am very close to this, how can I get back the value back?

Added to OP comment

I updated code, but, I still can not find anything Anyone can please me, please help me understand that what am I missing?

The following is in the form.cfm:

  & lt; Script src = "/ /ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script language = "javascript" type = "text / javascript" & gt; Click (function ($ {$ .aJX {{type: "get", url: "awardTotals.cfc? Method = searchAward", data: {total: $ ("val (), codeNum: $ (" codeNum "Val", "selJuris: $ (" selJuris ") .value}, success: work (data) {Values}: $ (" test year ") Val, selType: $ (" selType "). If (hatotles == true) {warnings ('a match is');} and {warnings (' this is not a match)}}}});})}}   

My reward is total cfc.

   cfunction name = "searchAward" access = "remote" returntype = "any">       

You are passing in a grandolate and your method is looking for awards. You are returning empty string and looking for boolean. Try it:

  FunctionAdvancedFunding (AwardTotals) {$ .ajax ({url: 'awardTotals.cfc', data: {Method: 'SearchAwards', AwardTotals: NumberTop}, Success: Work ( Data) {if (isTotals == true) {Warning ('is a match');} else {warning ('this is not a match;)}}}}); }   

then

  & lt; Cfcomponent & gt; & Lt; Cffunction name = "myfunction" access = "public" returntype = "query" & gt; & Lt; Cfargument name = "awardTotals" type = "string" required = "true" & gt; & Lt; Cfset var searchAward = queryNew () & gt; & Lt; Cfquery name = "searchAward" data source = "test" & gt; Please select G. Code 1 + G Code 2 + G Code 3+ Code 4 AS Grandetral FRR Code GJ WHERE G. Coding = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.coding # #" & gt; And G. TestYear = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#forms.act year #" & gt; And g Cell type = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.selete type #" & gt; And g Jurisdiction = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#forms .seeljuris #" & gt; & Lt; / Cfquery & gt; & Lt; Cfscript & gt; If (arguments.awardTotals eq searchAward.grandTotal) {return true; } Other {return false; } & Lt; / Cffunction & gt; & Lt; / Cfcomponent & gt;   

And @ Billy Craven is correct, you can not use cfajaxproxy, but jquery ajax will work.

No comments:

Post a Comment