JSON

JSON solves 2 problems:

1. It's a text, so it's very easy for network transmission. -- faster.

  • get JSON Data String from server: request.reponseText

2. It could also be easily converted into an object, which is very convenient for data manipulation. --convenient.

  • var itemDeatils = eval( '(' + JSON_DATA_STRING + ')'); //JavaScript's build-in function eval() could easily turn JSON Data String that you got from server into an object.
  • now you could use dot notaion on "itemDetails" now.