Saturday, July 07, 2007

What about JSON

Last year Yahoo introduced JSON. An ajax-alike javascript methodology. I recently used this technique in a website where ajax was not an option, since the server running the website (a .Net cms) was not the same as the server responding to the ajax calls (ColdFusion/Oracle). JSON however can be used in a construction like this (though if everybody starts exploiding it, browsers may close this option in future releases).

JSON is based on
<script src="http://www.someserver.com/some_script_engine.cfm/php/aspx" lanuage="javascript">

Yahoo offers a tutorial which uses a client-click to introduce a new <script>-tag in the html, performing a new JSON-request.

Another advantage of json is that it's fast! Ajax is xml, it means lots of overhead on your internet-line. JSON however is pure javascript content.

{ "Image": { "Width":800, "Height":600, "Title":"View from 15th Floor", "Thumbnail": { "Url":"http:\/\/scd.mm-b1.yimg.com\/image\/481989943", "Height": 125, "Width": "100" }, "IDs":[ 116, 943, 234, 38793 ] }}