ajax

Dangers of Ajax


I was reading about AJAX on IBM's website. Here is what it said,

If the application fails to communicate, it might leave users unsure about what is actually happening. If they click a Form Submit button and nothing happens, they might assume the Web site is broken. If the application fails to communicate that an error occurred, users generally assume that their action succeeded. This assumption can lead to extreme frustration if the reality is that the action did not succeed, especially if a user has just spent a long time working on the content of the form. If the application informs users when there is an error or timeout, at least the user has an opportunity to copy and paste the data and save it locally, thus avoiding one of the worst possible user experiences.

Now this problem can also occur while using JavaScript or HTML. Why does the author refer AJAX as "Ajax can ruin your site"?


Solution

  • It's dangerous because when using AJAX to process form submissions, you are changing the usual user experience. When a user clicks on the submit button, you are in charge of informing them that something is actually happening (Placing a loading gif for example)

    If the request fails, it's also your responsibility to inform the user that it failed, and perhaps offer a solution and information. If you don't, the user will be clueless as to what happened, they won't know if their form submission really did something, if the information they sent has been saved... etc

    AJAX is "dangerous" because it completely relies on the developer to work fine.

    If the network connection is lost for example, the AJAX request will fail and many developers forget to use a timer to check for this kind of thing, thus the user will be left alone wondering what actually happened. If the request did make it to the server, but the answer didn't return, the action might have been done (e.g. registering a new user), but the user won't know.