Web
News |
Avatars in our future Online shopping a bit of a bore? Just wait. Within five years, you may be able to send in a digitized alter-ego to kick the tires, ask the obnoxious questions and do your shopping in a virtual world. IBM is involved in a...
Nortel revival continues, CEO says Nortel Networks Corp. (TSX:NT) stock continued its decline Friday, slipping for a third straight day and ending the week at its lowest close since October 2002. The closing stock price of $17.89 was down 15 cents or 0.83 per cent from Thursday's close on the Toronto Stock Exchange...
Taiwan trade rep forging tech links with B.C. The average consumer probably didn't notice it, but when Acer, a Taiwan-based maker of personal computers, recently struck a deal to buy Irvine, Calif.-based Gateway Computers for $710 million US, it became the third...
|
|
|
09.20.07
Quick & Dirty JSON/Query Example
By Raymond Camden
Yesterday in the ColdFusion chat room someone asked a question (a technical question at that - guess how rare that is?) about how they could use a JSON-encoded query.
I whipped up a quick example that I thought others might like as well. This example does not use Ajax to load the JSON data - which is also pretty rare - but I wanted something that I could run all in one file. So here we go...
The first thing I did was get a query of data and serialize it using SerializeJSON:
At this point, jsondata is a string. Here is what it looked like:
I wanted to work with this on the client side (the whole point of this entry), so I needed to set this data to a JavaScript variable. The cool thing about JSON is that it can be evaled (think of this like ColdFusion's evaluate function) directly to a variable, so I used this code to assign it:
Continue reading this article.
About the Author:
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com
Raymond Camden is Vice President of Technology for roundpeg, Inc. A long
time ColdFusion user, Raymond has worked on numerous ColdFusion books
and is the creator of many of the most popular ColdFusion community web
sites. He is an Adobe Community Expert, user group manager, and the
proud father of three little bundles of joy.
|
|