Cool, got stuff from the examples...thanks. It's working as expected now. I like that you can send any kind of argument to your cfc now. I think in the past you had to send an array. This is good stuff.
-- Josh ----- Original Message ----- From: "Daemach" <[EMAIL PROTECTED]> To: <discuss@jquery.com> Sent: Wednesday, February 28, 2007 3:43 PM Subject: Re: [jQuery] Need some guidance... > > The jQuery port is still in Alpha - hasn't made beta yet. I pieced most > of > this together from reading the code and some examples Rob provided in > Alpha > 1. > > If you just follow the instructions, it should work in nearly every case. > Really the only things that change are in the ajaxcfc call itself; the URL > to your cfc (if you split your functions up for different applications), > the > data you're sending and the success function. You can pretty much cut and > paste everything else. Just make sure you put the ajaxcfchelper calls > outside the document.ready function. > > Also note that for some reason the guy that ported json to json.cfc > decided > to break from the wddx recordset convention by creating a subnode for the > query data (called .data). wddx puts the column arrays in the root of the > object. iow, getting to the first row of a column named foo in json is > myObj.data.foo[0] - in wddx it's myObj.foo[0]. > > I have entertained thoughts of modifying json.cfc so that the resulting > recordset structures are identical but I don't want to break > compatibility. > Frankly, the json structures are more compact so I'm just converting to > using them instead of wddx. > > > > Josh Nathanson-2 wrote: >> >> Daemach, did you figure out the config information for AjaxCFC yourself, >> or >> is it documented somewhere? I looked in the docs that download with >> AjaxCFC >> but I couldn't find any config information. There are so many js files >> in >> there, I didn't know which ones to include. >> >> -- Josh >> >> ----- Original Message ----- >> From: "Daemach" <[EMAIL PROTECTED]> >> To: <discuss@jquery.com> >> Sent: Wednesday, February 28, 2007 2:59 PM >> Subject: Re: [jQuery] Need some guidance... >> >> >>> >>> Hi Rick - >>> >>> This is one of those things I would use ajaxCFC for since it handles >>> serialization automatically. The idea here is that you need to >>> serialize >>> the values of your form fields, send them to the server, deserialize, >>> calculate and put the results into some kind of structure which gets >>> serialized again and returned to the browser for processing which starts >>> with deserializing. Dealing with the serialization/deserialization >>> transparently is what makes ajaxCFC so great. >>> >>> First, download ajaxcfc here: >>> http://www.robgonda.com/blog/projects/ajaxcfc/download.cfm >>> >>> in the zip file drill down to ajaxCFC/branches/jquery/core/. Put the >>> .cfc's >>> in some accessible folder on your web server, then copy everything >>> inside >>> the /js folder to your javascript repository - I create a subfolder to >>> keep >>> it separate: /js/ajaxCFC. That's it for the install. >>> >>> This sample code should get you started. I stuck the ajax call directly >>> into the click event on the button, but you could put all of that in a >>> separate function and then call the function from the click event >>> handler >>> if >>> you want. >>> >>> =========================== >>> >>> >>> your html/cfm page with the calculator: >>> >>> <script type="text/javascript" src="/js/jquery.js"></script> >>> <script type="text/javascript" >>> src="/js/ajaxCFC/jquery.AjaxCFC.js"></script> >>> >>> <script type="text/javascript"> >>> // additional files >>> $.AjaxCFC({require:'json'}); >>> // more additional files >>> // $.AjaxCFC({require:'json,wddx,dDumper,log4j,DWRSyntax,blockUI'}); >>> >>> // optional global settings >>> // using these setters also automatically include dependencies >>> //$.AjaxCFCHelper.setAjaxLoadImage("#snort","/images/ajax_circleball.gif"); >>> $.AjaxCFCHelper.setDebug(false); >>> $.AjaxCFCHelper.setBlockUI(false); >>> $.AjaxCFCHelper.setUseDefaultErrorHandler(false); >>> $.AjaxCFCHelper.setSerialization('json'); // json, wddx >>> >>> $(document).ready( function() { >>> >>> // Add click event to button >>> >>> $('#ajaxit').click(function() { >>> //create an object to pass to the cfc. can also be an array, simple >>> value, whatever you want. Objects turn into cf structures. >>> var obj = {firstVal:$('#firstVal').val(), >>> secondVal:$('#secondVal').val(), >>> thirdVal:$('#thirdVal').val(), randomstring:"why not"} >>> //do ajax call >>> >>> $.AjaxCFC({ >>> url: "/pathto/your.cfc", >>> method: "calculate", >>> data: obj, >>> // can be an anonymous function, or the name of the function that will >>> handle the return results. >>> success: showResults >>> }); >>> }); >>> >>> }); >>> >>> function showResults(data){ >>> // data will be whatever the cfc passed back in js format - structure in >>> this case to make it easy. >>> $('#result').val(data.results); >>> >>> } >>> >>> </script> >>> >>> firstVal: <input id="firstVal" name="firstVal" type="text"><br> >>> secondVal: <input id="secondVal" name="secondVal" type="text"><br> >>> thirdVal: <input id="thirdVal" name="thirdVal" type="text"> >>> <input id="ajaxit" type="submit" name="ajaxit" value="AjaxIt"> >>> <hr> >>> >>> result: <input id="result" name="result" type="text"> >>> >>> >>> ================ >>> >>> Your cfc file should go in the same folder as ajax.cfc: >>> >>> >>> <cfcomponent extends="ajax"> >>> <!--- >>> <cfscript> >>> setDebugMode('request'); >>> </cfscript>---> >>> >>> <cffunction name="calculate" output="no" access="private"> >>> >>> <cfscript> >>> obj = arguments; >>> data = structNew(); >>> temp = obj.firstVal + obj.secondVal + obj.thirdVal; >>> StructInsert(data, "results", temp); >>> </cfscript> >>> >>> <cfreturn data> >>> </cffunction> >>> </cfcomponent> >>> >>> >>> >>> Rick Faircloth wrote: >>>> >>>> Hi, all. >>>> >>>> I've just started using jQuery recently and now >>>> I'm trying to understand how to use it with AJAX >>>> and I just don't know enough about how it works >>>> to get started on a fairly simple app. The sample app I've >>>> been tinkering with sends a URL variable for a User_ID >>>> using AJAX to a CF page, which runs a query and >>>> returns the info to the calling page and appends >>>> it to the body. I'd like to send results back to the >>>> form fields, as well as the calculated result. >>>> >>>> I just don't have a clue how to set this up. >>>> >>>> I have a mortgage calculator and I want the user >>>> to be able to enter the principal, interest rate, >>>> and duration in years, then run a calculation on it >>>> and return the result. >>>> >>>> I've set this up in a regular form that submits back >>>> to the page it's on and it works fine. It's coded in CF. >>>> >>>> I'd like to be able to calculate and return the results using AJAX. >>>> >>>> I've worked some very simple code using AJAX (actually >>>> it was given to me), but I have no idea how to code for >>>> the above scenario. >>>> >>>> Would anyone care to give this CF'er some guidance >>>> on creating this small jQuery/CF/AJAX app? >>>> >>>> Thanks for any help! >>>> >>>> Rick >>>> >>>> _______________________________________________ >>>> jQuery mailing list >>>> discuss@jquery.com >>>> http://jquery.com/discuss/ >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Need-some-guidance...-tf3323366.html#a9240414 >>> Sent from the JQuery mailing list archive at Nabble.com. >>> >>> >>> _______________________________________________ >>> jQuery mailing list >>> discuss@jquery.com >>> http://jquery.com/discuss/ >> >> >> _______________________________________________ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> >> > > -- > View this message in context: > http://www.nabble.com/Need-some-guidance...-tf3323366.html#a9240959 > Sent from the JQuery mailing list archive at Nabble.com. > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/