Monday, February 19, 2007

JSON - Alternative to XML in Ajax

JSON is a language of objects sent by the server.
The Client receives a Javascript object easier to control than the use of DOM or XSL.

XML Example:
<menu id="file" value="File">
<popup>
<menuitem value="New" onclick="CreateNewDoc()" />
<menuitem value="Open" onclick="OpenDoc()" />
<menuitem value="Close" onclick="CloseDoc()" />
</popup>
</menu>
JSON Example:
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

Links:
http://en.wikipedia.org/wiki/JSON
http://www.json.org/java/

Canvas Element

Canvas Element is a new HTML element which can be used to draw graphics using scripting (usually JavaScript). It can for instance be used to draw graphs, make photo compositions or do simple (and not so simple) animations. The image on the right shows some examples of Canvas implementations which we will see later in this tutorial.
Canvas was first introduced by Apple for the Mac OS X Dashboard and later implemented in Safari. Gecko 1.8-based browsers, such as Firefox 1.5, also support this new element. The Canvas element is part of the WhatWG Web applications 1.0 specification also known as HTML 5.

(Taken from: http://developer.mozilla.org/en/docs/Canvas_tutorial)

Links:
http://en.wikipedia.org/wiki/Canvas_(HTML_element)
http://developer.mozilla.org/en/docs/Canvas_tutorial