No sweat, Paul. It was my pleasure. :o)
Paul wrote:
This is great, Chris. Thanks a bunch for taking the time to send it.
I'm sure I'll have questions as I progress...
paul
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
*On Behalf Of *Christopher Jordan
*Sent:* Tuesday, February 06, 2007 11:02 AM
*To:* jQuery Discussion.
*Subject:* Re: [jQuery] AjaxCFC (paging Rey Bango...)
Paul,
use "serialization: json" in your ajaxCFC call, and when your query is
returned it will be valid JSON (which is valid JavaScript). Then you
to an eval of that JSON string and it will become a JavaScript object
that you can use like this:
FlexOrderData = eval("(" + data + ")");
//dump(FlexOrderData);
var myRecordCount = FlexOrderData.recordcount;
var myTempDate, myBackgroundColor, myShiftDate, myCalendarCell,
myCells, myKey, myCellIndex;
var myjQueryString = "";
var myContractDates = {};
for(i = 0; i < myRecordCount; i++){
myShiftDate = CFJS.ListFirst(FlexOrderData.data.SHIFTDATE[i],".");
myShiftDate = FlexOrderData.data.SHIFTDATE[i].split(".")[0];
myOrderID = FlexOrderData.data.ORDERID[i];
myAssignRep = FlexOrderData.data.ASSIGNREP[i];
myAssignDateTime = FlexOrderData.data.ASSIGNDATETIME[i];
myEmployeeConfirmRep =
FlexOrderData.data.EMPLOYEECONFIRMREP[i];
myEmployeeConfirmDateTime =
FlexOrderData.data.EMPLOYEECONFIRMDATETIME[i];
myClientConfirmRep =
FlexOrderData.data.CLIENTCONFIRMREP[i];
myClientConfirmDateTime =
FlexOrderData.data.CLIENTCONFIRMDATETIME[i];
...
}
In my example above "FlexOrderData" is a query that I returned that
was serialized using JSON. CFJSON, which Rob uses in AjaxCFC,
automatically returns Queryname.RecordCountand Queryname.ColumnList
along with the data in order to keep it feeling like CF. So in the
example above you can see that I first evaluate the JSON, after which
my "queryname" is now "FlexOrderData".
One of the things to keep in mind is that **case is NOT preserved**.
Recordcount is 'recordcount' and all field names are UPPER-CASED. I
hope this along with my example are helpful.
Below is an example AjaxCFC call in jQuery (Rob, Rey... correct me if
I'm wrong here or the syntax has changed)
$.AjaxCFC({
url: "/Path/To/My.cfc",
method: "MyMethod",
data: ,
unnamedargs: false,
serialization: "json",
success: function(data) {
dump(data); // dump is not part of AjaxCFC.
MyQueryName = eval("(" + data + ")");
//... etc., etc.
}
});
Again, I hope all this helps.
Cheers,
Chris
Paul wrote:
Chris,
I just realized that the zip I grabbed from AjaxCFC was the stable
(not jQuery alpha) release. I just tapped into the SVN repo and am
now looking at the jQuery examples.
It seems there is only one straight-up jQuery example---the other
three seem to be illustrating compatibility with DWR methods. How
does one handle a CF query object without the DWR methods and syntax?
Thanks,
Paul
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[mailto:[EMAIL PROTECTED] *On Behalf Of *Christopher Jordan
*Sent:* Tuesday, February 06, 2007 10:13 AM
*To:* jQuery Discussion.
*Subject:* Re: [jQuery] AjaxCFC (paging Rey Bango...)
Paul,
Have you downloaded the AjaxCFC for jQuery package from RIA Forge? It
contains examples.
Hope this helps,
Chris
Paul wrote:
About 2 weeks Rey Bango posted that AjaxCFC had been updated to
implement jQuery 1.1, but apparently the ajaxCFC demos have not yet
been updated to reflect the change. Since I'm too inexperienced to
fumble my way through it properly, can anybody point me to some basic
getting-started information regarding ajaxCFC and jQuery together?
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected] <mailto:[email protected]>
http://jquery.com/discuss/
--
http://www.cjordan.info
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected] <mailto:[email protected]>
http://jquery.com/discuss/
--
http://www.cjordan.info
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
http://www.cjordan.info
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/