JSON and Movable Type

| 0 Comments
I've been working off and on on an extension to Movable Type that allows you to do surveys, and it's proved to be a good testing sandbox for me to try out new ideas for hacking on Movable Type. One of the things that shows a lot of promise is getting an extension to build JSON for enabling AJAX throughout an extension. I admit that there is some overhead in using a descendant of MT::App to generate JSON from a template file, but it should be less intense on the server than having it generate the whole page or widget. Every browser out there that is at least a few years old fully supports JSON and DOM scripting, so there is no reason to make the server generate the whole page when most of the generation can be done on the client side by building the page from descriptions in the JSON sent back by the server. To put this into perspective, all I would have to send back from the server to communicate the results of a simple survey, would be a JSON block that looks like:
 
{
     questions: ["What type of blog is your favorite?", "Where do you host your blog?", "Do you plan to switch software?"],
     types: ["MC", "MC", "TF"],
     answers: [["Tech","Politics","Religion","Entertainment"],
["Blogger","Typepad","WordPress.com","Self-hosted"], ["Yes", "No"]],
     responses: [[20,20,20,40], [50, 10, 10, 30], [40, 60]]
}

That could make for less overhead in rebuilding a template data intended to feed AJAX data to other parts of the application.

Leave a comment

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Recent Entries

A window into the totalitarian mind of the left on freedom of religion
From Digg: Me: I'm not going to hold my breath waiting for the same liberal democrats who shriek about the…
Google's lossy compiler
Google's closure compiler service gets a little too frisky under ADVANCED_OPTIMIZATIONS. Original code: With advanced optimizations enabled, it was able…
The three purposes of the federal income tax law
Businesses will spend about 3.4 billion man-hours and individuals about 1.7 billion hours figuring out their taxes this year.…

Subscribe

Advertisements

OpenID accepted here Learn more about OpenID