Ajax: an immature standard

Ajax is surely one of the best things that came along with the newest features of the Web 2.0 wave. But there's a catch: Ajax is still an immature standard because of the lack of some basic functionalities. First of all, the native handling of content types lacks of support to JSON. In fact, you have the responseText and responseXML properties as native features of the XMLHttpRequest object (or XHR for short). There's no responseJSON, though. So you have to use the eval function in order to parse and execute a JSON file, but this approach exposes your code to some nasty security problems.

Second, Ajax has no way to handle server requests correctly. It only provides some basic information about the server status via HTTP codes, but there's no way to handle a transaction without using some JavaScript functions or routines. For example, what happens with queued requests? What happens if the server is busy and cannot perform the request you've just activated? I've seen this behavior mostly on Gmail and Facebook. Simply put, the errors returned are quite inconsistent because there are no ways to describe them better. For example, Facebook asks you if you're still connected to the Internet and Gmail hangs up for so long that you're forced to close your browser's window. That's because Ajax has still no way to handle these issues better.

JavaScript libraries can actually mitigate this problem but they can't do miracles. So the best thing you can do is being very careful when you use some Ajax features.

Leave a Reply

Note: Only a member of this blog may post a comment.