开发者

Consuming ColdFusion json data with jQuery templates

Rebecca Murphy talks about using jQuery templates. The JSON that Rebecca uses looks like开发者_Python百科:

[{CITYNAME:'A'},{CITYNAME:'B'},{CITYNAME:'C'}]

I'm using returnformat:'json' and ?queryFormat=column in a call to a remote ColdFusion component.

The data that I'm getting back is more like:

result.qry.DATA.CITYNAME:"A","B","C"

Q: Is it possible to use jQuery templates with json data returned from ColdFusion?


If you check the livedocs for the ColdFusion Data Interchange Formats, you're going to end up with something like what you have, but what you pasted certainly can't be everything you got back.

If you want something more like what Rebecca's tutorial says, then you need to use queryFormat=row, and it will return each row as a structure. Using queryFormat=column will return each column in a structure, and then an array of values.

Row:

[{CITYNAME:'A',ID:1},{CITYNAME:'B',ID:2},{CITYNAME:'C',ID:3}]

Column:

[{CITYNAME:['A','B','C']},{ID:[1,2,3]}]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜