Skip to Main Content
Head Rush Ajax
book

Head Rush Ajax

by Brett McLaughlin
March 2006
Beginner to intermediate content levelBeginner to intermediate
448 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Head Rush Ajax
376
Chapter 7
The young upstart: JSON
JSON is more about curly braces than the brackets
you use in XML, but it can store all the same data
that XML documents can:
{“totals”: [
{
“boardsSold”: 1710,
“bootsSold”: 315,
“bindingsSold”: 85
}
]};
Here’s the JSON equivalent
of the XML you looked at
on the opposite page.
“totals” is at the
top-level, and
contains the three
other pieces of data.
There are three individual
bits of data, each with a
numeric value.
“boardsSold”, “bootsSold”, and “bindingsSold”
are the names of each piece of data...
...and 1710, 315, and 85
are the data values.
JSON is relatively
new to the Ajax
scene, but has a lot
of big fans already.
<?php
require(‘lib.php’);
function go() {
$myVar = ...
return ...
}
?>
PHP script
You work
with JSON
using
“normal”
JavaScript.
json from the server
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
Head First Ajax

Head First Ajax

Rebecca M. Riordan

Publisher Resources

ISBN: 0596102259Errata PageSupplemental Content