ColdFusion JSON represent!
 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Nando
Sent: Tuesday, April 14, 2009 9:51 AM
To: jQuery (English)
Subject: [jQuery] Re: Converting JSON to html output


Sure. Here's the JSON string being returned by the server. The only thing
that will need some fiddling is that the year is being returned as a float.
Not sure how to get that displayed as just an integer in JS.

{"COLUMNS":
["REFERENCEID","AUTHOR","DETAIL","REFYEAR","REFTYPE"],"DATA":[[1,"Chen
& Chen","Chinese Herbs and Recipes, Second Revision",2009.0,1], [16,"Dana
Cat","","",1],[5,"Simon Becker","Chinese Medicine Today", 2008.0,1],[14,"tom
cat","",2009.0,1],[4,"Becker, Simon","Chinese Medicine
Today",2009.0,2],[3,"Dana","Dana's Secret Pasta Recipe", 2008.0,5],[15,"bob
cat","",2007.0,5]]}

On Apr 14, 4:32 pm, MorningZ <morni...@gmail.com> wrote:
> Can you give an example of the JSON to help?
>
> On Apr 14, 9:24 am, Nando <d.na...@gmail.com> wrote:
>
> > Hi,
>
> > I'm a jQuery and Javascript noob, and can't seem to get this to work.
> > The JSON output looks right to me via console.log(result), but the 
> > select box isn't being populated. The select box needs to be 
> > populated onfocus, because the interface is set up to allow the user 
> > to add new options to the select via a popup without a page refresh.
>
> > $(function() {
>
> >   $.getJSON('index.cfm?view=listReferenceJSON',
> >     function(result,status) {
> >       console.log(result)
> >       var str = ''
> >       for(var i=0; i < result.ROWCOUNT; i++) {
> >         str+= '<option value="'+result.DATA.REFERENCEID[i]
> > +'">'+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')<option>'
> >       }
> >         $("refSelectBox").bind('focus', function(event, ui) {
> >           $("#refSelectBox").html(str)
> >         }
> >     });
>
> > });
>
> > <select id="refSelectBox"></select>
>
> > Thanks in advance for any help.
>
> > Nando


Reply via email to