Skip to main content

Limitations of Ajax

If you do not know the term "AJAX" you should not be reading this post. This post assumes that you have worked with AJAX in the past before.I use AJAX a lot with my applications. I ran into some limitations over the years with AJAX. I thought it would be a good idea to list these limitations and how I was able to overcome them.As many of you know, AJAX is a solution that allows our applications to communicate asynchronously. Due to the nature of asynchronous communication, web browsers partially update contents on a given page. When back or forward buttons are used, the pages in question will not go back or go forward to the its updated/initial state. A similar problem will exist with bookmarks. Since the content is updated with the same url, the state of the page is lost to be saved.One way to overcome this limitation is to use a framework called RSH. This framework basically allows you to manipulate web browsers history object. It allows you to store state information within the browsers history object by letting you create a key-value pair map. It also allows you to specify listeners that get triggered when the browsers back or forward button is clicked. Once the listeners are executed, with API calls you can extract state information and rebuild your content.Another problem with browsers and AJAX is that sometimes depending on your browsers setting, content returned by AJAX calls will be cached. Even if the returned content is different, browsers will be loading the content from their cache. One way to solve this problem is to change your browsers setting so that content is not cached or your browsers cache is purged frequently. Obviously this is not a solution that you would like to force on your users. The other common solution to this problem is to make AJAX action urls unique for each call. The common practice is to include date-time string to your urls. For example, if you were to call /action/dosomething.do?param=value, you can attach date-time string at the end of the call. It would look like /action/dosomething.do?param=value&datetime=11111111111. This would fix the problem of caching.

Comments

Vishnu said…
Nice this is full for me
But provide More
Thanking U