You have no idea whether your piece of code actually works – you need to run it to see whether it’s ok. Combine this with the typical behavior of IE on a dev machine, popping up a message box whenever a JS error occurs, or different parsers with different sensitivities to well- and mal-formedness of code in different browsers (missing a semicolon, adding a comma too much), and it’s easy to see that for people used to compiling code there was a lot to dislike.
The first restructuring was to avoid global variables as much as possible, encapsulate the Ajax calls in a static object, and each dialog in one function, with the event handlers implemented as local function variables.
Finally, a couple of links to introductory news articles that drew my interest for TypeScript:
- Why does TypeScript have to be the answer to anything?
Give it a try!
Pingback: Installing TypeScript in Visual Studio 2010 « devioblog