Thanks for the tip, David!

 

I'll have a look at jTemplates.

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of David Meiser
Sent: Thursday, February 05, 2009 12:52 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Turning JSON-formatted AJAX data into data usable by 
ColdFusion

 

Rick,

I've got a project that I used jTemplates on.  They're nice because you use 
standard HTML to
template with and just wrap your JSON items in braces.  For me, at least, it 
took a bunch of
javascript strings (some upwards of 1000 characters) and replaced them with a 
straightforward block
of HTML code.  Word of caution, though: jtemplates does increase load times 
(hardly noticeable on a
modern browser - including IE8, but moderately noticeable on IE7 and very 
noticeable on IE6).

http://plugins.jquery.com/project/jTemplates
http://jtemplates.tpython.com/
http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=472

Good luck!

On Wed, Feb 4, 2009 at 12:26 PM, Charlie Griefer <charlie.grie...@gmail.com> 
wrote:

Unfortunately, right now I just don't have the time to take on another project 
(even a small one
like 'code consulting'), otherwise I'd be happy to.

 

As far as someone who knows CF... that shouldn't really be an issue.  You've 
-got- the data back
already.  You just need someone to show you how to work with it in jQuery.  
Hopefully someone else
on the list has some extra time and needs some wish list items :)

 

But yeah, in the interim just rely heavily on the docs and write out some 
static examples of your
own to get a feel for it.  The first link I gave you shows an example of using 
.each() to loop over
JSON data:

 

var obj = { one:1, two:2, three:3, four:4, five:5 };

 

I understand that the data you're working with might be more complex than 
that... but if you can get
comfortable working with that, it's less of a shock to the system to work with 
more complex data.

 

On Wed, Feb 4, 2009 at 9:18 AM, Rick Faircloth <r...@whitestonemedia.com> wrote:

yeah, I know.it's not a bummer "knowing" more JS, but at this point

projects are falling behind and I can't afford much more time for

education.  It's time to produce!  I could have written this app 20 times

by now except for the JS/AJAX part!  

 

Maybe it's time to once again turn to a private tutor to get me over the hump.

Are you interested in an hour or two soon to work out the code for this app

(basically, just showing me how to use the data that I'm putting out now)

and showing me how to use it for some "wish-list" gifts or something?

 

You can just email me off-list about it. r...@whitestonemedia.com

I can post code online at some of the "code-posting" sites and we could

IM and/or email responses.  I did this recently and the person who helped

out just wrote the necessary code and then explained it to me.  Took about

an hour or so.

 

I know that you understand jQuery *and* CF, which be essential to making this

work properly.  Just let me know.  If you're not interested or don't have the 
time,

perhaps someone else who can help will be.

 

Meanwhile, I'll check out the jQuery docs and see if any bells ring or lights 
come on!

 

Rick

 

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Charlie Griefer
Sent: Wednesday, February 04, 2009 12:00 PM


To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Turning JSON-formatted AJAX data into data usable by 
ColdFusion

 

Having to learn more JS shouldn't really be a "bummer".  More tools in the 
toolbox isn't a bad
thing.

 

i don't think you need any particular plug-ins... just read the jQuery docs.

 

http://docs.jquery.com/Utilities/jQuery.each#objectcallback

 

that'll iterate over a JS object or array.

 

As you're looping over the data, you'll likely be wanting to manipulate various 
page elements with
that data.

 

http://docs.jquery.com/Manipulation

 

On Wed, Feb 4, 2009 at 8:51 AM, Rick Faircloth <r...@whitestonemedia.com> wrote:

Oh..so true.  Didn't even think of it that way.

 

Bummer.that means I've got to learn more JS!

 

I've looked at some blogs and tutorials that deal

with outputting JS, but they've all dealt with queries.

 

Know of any resources that provide guidance for dealing

with structs?

 

My current CFC creates data from two queries and some

single pieces of data and puts them into a struct.

 

Parsing through that is proving to be a little more

than I can figure out at this point.

 

Is there any jQuery plug-ins that help deal with parsing

and outputting JS data that I can use to by-pass writing

raw JS?

 

Projects are getting behind trying to figure out the

AJAX approach.perhaps it's just time to shelve AJAX

and go back to regular CF code for awhile.

 

Thoughts?

 

Thanks,

 

Rick

 

 

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Charlie Griefer
Sent: Wednesday, February 04, 2009 11:23 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Turning JSON-formatted AJAX data into data usable by 
ColdFusion

 

you're overlooking the fact that CF executes on the server.  JS executes on the 
client.

 

When you get data returned from an AJAX call, you're on the client.  You're in 
the realm of JS.
There's no "converting" the data into a "usable" (CF) format at that point.  
All of the CF is done
on the server (during the AJAX call, when you're returning JSON from the CFC).

 

Once it's been returned to your jQuery, you'll be working with the data in JS 
(jQuery).

On Wed, Feb 4, 2009 at 5:07 AM, Rick Faircloth <r...@whitestonemedia.com> wrote:


Ok, so I'm at the point in using jQuery AJAX where I'm now
returning complicated data of queries (multiple) and bits of
data for use back on the calling page.

In my CFC's, I use the returnFormat="json" to send data back
properly json-formatted.

However, now, I need to know how to get that json data back
into a form that I can use with my CF knowledge.  Such as
looping queries, referring to data by "myQuery.name", etc.
In other words, I want to get that json data back into my
comfort zone.

I need to know what technique to look at.  I've looked over
many resources and they all seem to offer a little different
approach.  I have no experience with which to evaluate these
approaches.  CFSON seems to be the most likely candidate.

So, to get this json data (below--from one of my CFC functions),
back into ColdFusion, what does everyone suggest?

Thanks for *any* guidance!

Rick

Here's the data mentioned above--does using CFJSON translate this
back into "ColdFusion format" without me having to write a bunch
of js code to loop the code etc, to translate it?



{"MONTH":2,"QGETSCHEDULE":{"COLUMNS":["DUTY_ID","DATE","AM_PM","AGENT_ID","POSITION","FIRST_NAME","L
AST_NAME"

],"DATA":[[1677,"February, 28 2009 
00:00:00","am",18,"primary","Mary","Fail"],[1678,"February, 28
2009

 00:00:00","am",19,"alternate","Rebecca","Nottingham"],[1679,"February, 28 2009
00:00:00","pm",20,"primary"

,"Renea","Camper"],[1680,"February, 28 2009
00:00:00","pm",21,"alternate","Verjuana","Underwood"]]},"MESSAGE"

:"Success","YEAR":2009,"SELECTED_DATE":"2009-02-01","QGETDUTYDATES":{"COLUMNS":["DATE"],"DATA":[["Fe
bruary

, 01 2009 00:00:00"],["February, 02 2009 00:00:00"],["February, 03 2009 
00:00:00"],["February, 04
2009

 00:00:00"],["February, 05 2009 00:00:00"],["February, 06 2009 
00:00:00"],["February, 07 2009
00:00:00"

],["February, 08 2009 00:00:00"],["February, 09 2009 00:00:00"],["February, 10 
2009
00:00:00"],["February

, 11 2009 00:00:00"],["February, 12 2009 00:00:00"],["February, 13 2009 
00:00:00"],["February, 14
2009

 00:00:00"],["February, 15 2009 00:00:00"],["February, 16 2009 
00:00:00"],["February, 17 2009
00:00:00"

],["February, 18 2009 00:00:00"],["February, 19 2009 00:00:00"],["February, 20 
2009
00:00:00"],["February

, 21 2009 00:00:00"],["February, 22 2009 00:00:00"],["February, 23 2009 
00:00:00"],["February, 24
2009

 00:00:00"],["February, 25 2009 00:00:00"],["February, 26 2009 
00:00:00"],["February, 27 2009
00:00:00"

],["February, 28 2009 00:00:00"]]}}




-- 
I have failed as much as I have succeeded. But I love my life. I love my wife. 
And I wish you my
kind of success.




-- 
I have failed as much as I have succeeded. But I love my life. I love my wife. 
And I wish you my
kind of success.




-- 
I have failed as much as I have succeeded. But I love my life. I love my wife. 
And I wish you my
kind of success.

 

Reply via email to