ADBRITE ads links
You are here: CodeIdol.com > Ajax > Head Rush Ajax > A Fight To The Finish
Head Rush Ajax
| 7.1. A review of request and response formats
Before we dive into the JSON versus XML debate, let's review the data formats we've already used in the first six chapters.
Everything in the first part of the book sent text to the server using nam...
|
|
| 7.2. Should you use XML or JSON?
Joe and the JavaScript guys want to look at JSON, but Frank's PHP team thinks XML is the way to go. Which is the best data format? In this chapter, we're going to let JSON and XML take each other on, and see which ...
|
|
| 7.3. The heavyweight champion: XML
You've already seen how a server can return XML in response to your request:
PHP script
<?xml version="1.0" encoding="utf-8"?>
<totals>
<boards-sold>1710</boards-sold>
<...
|
|
| 7.4. 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" is at the top-level, and contains the three other pieces of data.
Here's the JSO...
|
|
| 7.5. Frequently asked questions?
Q:So JSON is just another data format, like XML?A:That's right. Any time you send information between your web page and a server, you're going to need some way to format that information. So far, you've used plain ...
|
|
| 7.6. Just Do It
Before we discuss how JSON and server-side languages like PHP get along, let's take a closer look at how you can access JSON data in your JavaScript. Here's another JSON data structure:
{"books": [
{"title":"Hyperion", ...
|
|
| 7.7. So which is the better data format?
Well, it seems pretty obvious JSON is new, it's JavaScript-friendly, and I don't need to do any weird DOM navigation to get my data.
Obvious to whom? I still think XML is the clear winner. It's a standa...
|
|
| 7.8. Which data format should you use?: The choiceis yours!
Look, I'd rather be climbing a mountain than messing with a bunch of weird data formats. I use plain text for everything.
I've been designing web pages for years, and all I ever ne...
|
|
You are here: CodeIdol.com > Ajax > Head Rush Ajax > A Fight To The Finish
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|