ajaxCFC documentation added
I just updated the ajaxCFC download with initial documentation. I’ll keep improving as there is always room for improvement, but it has the minimal explanations and instructions to install and use.
If I’m missing something please do not hesitate to contact me, I will appreciate it.
If I’m missing something please do not hesitate to contact me, I will appreciate it.
TrackBacks
There are no trackbacks for this entry.
Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?1D7223FF-3048-7431-E4F80B32A9DA6944
http://www.robgonda.com/blog/trackback.cfm?1D7223FF-3048-7431-E4F80B32A9DA6944









i ran ajaxCFC (The one link you posted on my blog), tried the ECHO test, and got an invalid response from server error, right away.
any ideas?
thanks.
tony
Can you please more details? Did you run it from my server, or did you download it and ran it elsewhere? I just tested http://www.robgonda.com/blog/projects/ajaxcfc/exam... in 5 different browsers and they all worked.
Please provide details so I can either help debugging it or fix it to extend cross-browser support.
Thanks
-Rob
Tried http://localhost/test/examples/complexObjects/inde... and clicked the 'send' button. Received 'invalid response from server' message.
Tried in FF 1.0.7, FF 1.5, and IE 6.
batch.path = "echoTest.cfc"
statsInfo = "null.echo"
query=""method=init&callCount=1&c0-scriptName=null&c0-methodName=echo&c0-id=9922_1134429393155&c0-param0..."
In my current run, the batch.map structure's callCount property is 1, yet the other sciptName property is labeled "c0-scriptName" and its value is "null". Brief looks at the code, it should be trying to reference "c1-scriptName".
Thank you for all the provided information. I will try to download the zip that's up there and get back to you shortly.
-Rob
I just copied the complexObjects to 2 sites I have, one running cfmx6.1 and the other cfmx7.0.1... both of them ran fine.
I had them under:
http://www.somesite.com/test/complexObjects
and the JS folder at http://www.somesite.com/test/JS
I'm pretty sure you had the JS folder installed correctly, otherwise you would have seen the batch in the URL.
Do me a favor, try to debug it again (I use FF and live http headers), and check the server response. Actually, I’m not asking to you hack my own site :) but try debugging my example. You can actually right click the URL I’m calling (the one with the c0's) and paste it into a new browser and you’ll see the JavaScript response. You can do this because where’re using get verbs… You can change it to force post verbs, but that’s a different story; anyways, I’m digressing, if you do that in my site you’ll see a response, starting with something similar to ‘_9370_1134433016390 = new Object();’
Please try that in your server too and let me know what it says…
Thank you for your support.
It worked fine with Apache and IIS6, but seems like some Web Servers, or Firewalls perhaps were blocking this syntax… I am still unsure which one was the exact cause, but Tony pointed me to his files and I was able to make it work by rewriting the url in a different format.
I just updated the zip file; make sure you clear your cache, especially Firefox users, as it caches all Javascripts and won’t pick up the changes unless you do so.
Cheers
-Rob
[Object Error]
and same external path btw to hit it rob.
Did you clear your cache? I just tested your link and it came back fine... both btw, the echo and the complexObjects... please make sure you clear your cache and try again.
-Rob
Thanks,
Rob
Problem turned out to be ColdFusion Debugging information. Soon as I turned off debugger, everything starts working kosher. Anyone else reading this, make a mental note! :)
That makes sense now … Tony said that his code worked remotely, from the office, and from my pc too, but he couldn’t run it locally; probably again because of the same thing… debugging turned on for localhost.
I’ll add some adjustments to turn off debugging automatically for the ajax calls.
-Rob
Thanks
Tony
I'm heading out, so I'll add this to the documentation later;
anyways, you can do the following when receiving recordsets in the call back function:
alert( r.getRowCount() ); // will get your the recordcount
and
document.write( r.dump() ); // dump() will return a full data dump.
it comes as a structure of arrays, not an array of structures... that's why you can't get r.length.
you need to use r.col[i] instead of r[i].col
hope it helps.
Yes you can. There's a setter that's part of ajax.cfc that aborts the request after processing the response. Simple call the setAbortAfterRequest(true) function in your components (the one that extends ajax). Add that line outside all functions, so it gets executed onLoad.
Doing some simple debugging, I know that the cffunction is being called but on return I get an object error. I don't see how this could happen since no code has changed except for location of the files being used for ajax.
Any idea?
this is what i have written in the client side:
<script type='text/javascript'>_ajaxConfig = {'_cfscriptLocation':'Components/my_com.cfc', '_jsscriptFolder':'ajaxCFC/core/js'};</script>
<script type='text/javascript' src='./ajaxCFC/core/js/ajax.js'></script>
<script type="text/javascript">
function imprimir_modelos(result)
{
alert(result);
document.getElementById('td_modelos').innerHTML=result;
}
function modelos_de(id)
{
alert(id);
DWREngine._execute(_ajaxConfig._cfscriptLocation,null,'f_modelos',imprimir_modelos);
}
</script>
and here is my component on the server side:
<cfcomponent extends="ajax" >
<cffunction name="f_modelos" access="public" returntype="string">
<cfargument name="id_categoria" type="numeric" required="no">
<cfset myResult="">
<cfif IsDefined("arguments.id_categoria") AND arguments.id_categoria NEQ "">
<cfquery name="q_modelos" datasource="#request.dsn#" username="#request.dsnUsername#" password="#request.dsnPassword#">
select * from tbl_products where product_Category_ID = #arguments.id_categoria#
</cfquery>
<cfoutput query="q_modelos">
<cfset myResult = myResult & '<input name="model_#product_ID#" type="button" value="#product_Name#">'>
</cfoutput>
</cfif>
<cfreturn myResult >
</cffunction>
</cfcomponent>
sometimes it show me an error like an "alert" saying "object error", and sometimes "invalid reply from server"
thanks
HTH
batch.req.open("POST", batch.path, batch.async);
The same files and same exact code work on 2 different servers, with all kinds of ajax usage scenarios (querying data, saving data, auto-suggest controls, etc.) -- but none of them work on our laptops -- indicating some sort of configuration issue.
We did see some of the other posts here, and have since turned off Debugging, clearing the cache, but nothing seems to help. We just keep getting the [Object Error] message.
Anything anyone can recommend? or any other testing paths to go down?
Any help would be greatly appreciated.
Scott
HTH