|
Mailing Lists
|
Home /
Groups /
Ajax
Another problem debugging ajaxcfc program
I have a Javascript froblem. You can see it in action atkjuliff 05/12/07 06:07 P Kate,Andrew McDuff 05/15/07 08:15 A Where you ever able to figure out what the issue was? I am running into the same error message.Jason West 09/09/07 10:23 P Yes I worked it out and got it working but now I cannot remember whatKate Juliff 09/12/07 06:53 P I have a Javascript froblem. You can see it in action at http://www.gumnut.com/pub/private/ajax/index2.cfm When I click on the button to the right of the list of names I get an alert box that verifies that the parameter is correct and then I get the error: "message.indexOf is not a function" I don't understand this, as the function works in the example http://www.gumnut.com/pub/private/ajax/index.cfm Here are the relevant javascript functions function doQueryAndJS(id) { // send data to CF alert(id); DWRUtil.useLoadingMessage(); DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'doQueryAndJS', 1, doQueryAndJSResults); } // call back function function doQueryAndJSResults (r) { // evaluate server side JS eval(r); } and here is the cfc code <cffunction name="doQueryAndJS" output="no" access="private"> <cfargument name="uid" type="numeric" required="Yes"> <cfset var qReturn = '' /> <cfset var jsReturn = '' /> <!--- select from your query ---> <cfquery name="qReturn" dbtype="query"> select * from q where id = #arguments.uid# </cfquery> <!--- set JS commands to be executed ---> <cfsavecontent variable="jsReturn"><cfoutput> $('id').innerHTML = '#JSStringFormat(qReturn.id)#'; $('fname').innerHTML = '#JSStringFormat(qReturn.fname)#'; $('lname').innerHTML = '#JSStringFormat(qReturn.lname)#'; $('phone').innerHTML = '#JSStringFormat(qReturn.phone)#'; $('location').innerHTML = '#JSStringFormat(qReturn.location)#'; </cfoutput></cfsavecontent> <cfreturn jsReturn /> </cffunction> Help me PLEASE!! Kate -- View this message in context: http://www.nabble.com/Another-problem-debugging-ajaxcfc-program-tf3733302.html#a10450207 Sent from the Cold Fusion - AJaX mailing list archive at Nabble.com. Kate, Not sure what you're trying to do but it also appears that your other code which you say works (http://www.gumnut.com/pub/private/ajax/index.cfm), well it doesn't seem to work either. Everytime you click on a name in the list, the JS 'alert' box appears with the number 1 which means it will retrieve record number 1 always and hence display the same result in the area just below. In terms of debugging, you should use Firebug (an add-on to the Firefox browser) which can help you understand what's going on in the background. AjaxCFC uses "WDDX" (a sort of lightweight version of XML) to send data to the XmlHTTPRequest object for background processing (most of the processing is done in the "engine.js" file). When the processing finishes, it sends the data back to a callback function. Within this function, you then use JS to update your web page with the data. As I said, I'm not sure what you want to do or finally achieve. Let me know & I'll try to help out. I had loads of headaches getting AjaxCFC working with very simple queries plus I didn't have much JS experience but now I've got the hang of it. In the end, most of my errors were silly ones! As always, though, I'm still learning... Cheers, Andy Madrid, Spain Where you ever able to figure out what the issue was? I am running into the same error message. Thanks JLW ----- Excess quoted text cut - see Original Post for more ----- > function doQueryAndJS(id) { > // send data to CF > alert(id); > DWRUtil.useLoadingMessage(); > DWREngine._execute(_ajaxConfig._cfscriptLocation, > null, 'doQueryAndJS', 1, doQueryAndJSResults); > } > > // call back function > function doQueryAndJSResults (r) { > // evaluate server side JS > eval(r); > } > > and here is the cfc code > > <cffunction name="doQueryAndJS" output="no" access="private"> > <cfargument name="uid" type="numeric" required="Yes"> > > <cfset var qReturn = '' /> > <cfset var jsReturn = '' /> > > <!--- select from your query ---> > <cfquery name="qReturn" dbtype="query"> > select * from q > where id = #arguments.uid# > </cfquery> > > <!--- set JS commands to be executed ---> > <cfsavecontent variable="jsReturn"><cfoutput> > $('id').innerHTML = > '#JSStringFormat(qReturn.id)#'; > $('fname').innerHTML = > '#JSStringFormat(qReturn.fname)#'; > $('lname').innerHTML = > '#JSStringFormat(qReturn.lname)#'; > $('phone').innerHTML = > '#JSStringFormat(qReturn.phone)#'; > $('location').innerHTML = > '#JSStringFormat(qReturn.location)#'; > </cfoutput></cfsavecontent> > > <cfreturn jsReturn /> ----- Excess quoted text cut - see Original Post for more ----- Yes I worked it out and got it working but now I cannot remember what the problem was! Kate At 11:13 PM 9/9/2007, you wrote: ----- Excess quoted text cut - see Original Post for more -----
|
May 16, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||