Part 7 - Background about AJAX and JSON
Here’s a very brief overview of AJAX and JSON. Since we are using the MuseStorm Javascript components, no AJAX and JSON knowledge is really needed to create our AJAX desktop!
AJAX is such a hot buzzword today, that you’d think every mashup / web application is using it.
Well here is a shocking revelation: if you are building a mashup / web application - you are most likely to use JSON and not AJAX!
What is AJAX:
AJAX stands for Asynchronous Javascript and XML. Basically, when you use AJAX you use a Javascript object (named “XMLHttpRequest") to read XML data from a server without reloading the page. That’s really cool, but there’s a big limitation here - browsers will only let your AJAX object read data from the same server the original HTML page was downloaded from. So if you’re creating a Yahoo maps mashup, for example, you can’t use AJAX because your HTML page is served from one server, while the Yahoo XML data comes from a different server. You can work around this limitation by using your server as a proxy to the external XML source, but that makes things more complex and you have to carry the cost of the proxied traffic.
What is JSON:
JSON stands for Javascript Object Notation. Without going into the philosophy behind it, JSON is a data format that is automatically parsed into Javascript objects when read by the browser. Coupled with a DOM hack, it allows you to load data from remote servers (any server!) into your application without reloading the page. The only problem with JSON is that most Web API providers don’t fully support it yet.
The MuseStorm components use JSON to provide your application with the data you need as simple Javascript objects - objects you already know how to work with.
