Articles, Tips

Troubles When Developing With AJAX

July 23, 2010 • By

For those that are not familiar with AJAX, the word is an acronym for Asynchronous JavaScript + XML. AJAX is not new to the scene. In fact, even the newest advances in AJAX are at least five years old. Yet AJAX is becoming the buzz word in developing. AJAX is a very powerful technology that allows you to build a website with incredible functionality without users having to refresh the web page they are on. However, there are some “bumps” in the road when trying to utilize AJAX.

What does AJAX do? Basically, it makes it possible for a group of techniques to have interactive web applications to use Javascript to process XML/XHTML, with CSS, in a browser without having to reload the entire web. In other words, AJAX allows the browser and web server to synchronize the exchange of data, making the interaction and reloading of each web page faster.

One of the problems with Ajax is that its updates often contain information retrieved from a script running on the server side. It is very common for a browser to not display any kind of visual indication that any portion of AJAX is loading. The developer can’t see this interaction first hand, so it’s difficult to see exactly where to go in the application to be able to determine whether the client-side JavaScript is correctly communicating with the server or not. A solution for this is why it’s imperative to insert a visual indicator that will allow you to know something is occurring. You can use a visual swirl very similar to the ones used when a light box image is loading.

Another solution is to use Firebug to monitor HTTP communications. Let’s say that the page did not load as expected, or didn’t render precisely. By using the Firebug feature you’ll be able to determine if the HTTP communications flow is processing properly as the page loads, followed by including the jQuery library and the correct interaction of the server-side-script with the inclusion of the JavaScript mechanism. By using Firebug you will be able to see if the HTTP payloads between the client and server are communicating properly.

Another problem with AJAX is the problem of getting the “Back Button” on the browser to work properly in the JavaScript application. Developers asking for problems in their web applications if they fail to install a way for their content to reload automatically if the user tries to use the browsers back button. This happens when developers over use AJAX without trying to balance with other technologies.

Many developers and designers forget that despite the advanced technologies and the amazing evolution of the web, there are still some users that do not have a strong and stable internet connection. A good example of this is seen if you have ever played internet poker and noticed how many delays there are because other players keep losing their internet connection. There are still users that have small monitors and dial-up modems. Not everyone has a Mac Pro Quad-Core Intel Xeon “Nehalem” processor with a 30” monitor.

As a web developer or designer, there are times when you might consider using other means of interaction with your users to allow you to reach a wider audience. AJAX requires interaction with XML and JavaScript which will leave users with poor connections out in the cold.

As I mentioned above, a designer or developer to be successful and be able to reach a larger audience needs to have a balanced platform. I am not suggesting that you need to eliminate AJAX technology, because it is a super way to develop intriguing JavaScript applications. What I am saying is you must make sure your code is efficient and clean and you use AJAX sparely, or as needed. You also need to make sure you have all your bases covered and that all of the AJAX support information needed is in the proper place. Remember, the more AJAX running, the slower the web pages will load, which is completely opposite of the reason AJAX is so powerful.

One final point – search engine spiders have extreme difficulty trying to pick up content when AJAX is trying to load large amounts of text. Hence, the content isn’t published and indexed properly. Spiders need static content to be able to read it.

Ajax developers at times might need to develop almost two types of applications if they want to build an online application good for Firefox and Internet Explorer browsers that could require a lot more time for application development. The end result however, is well worth it. A highly efficient Ajax based application does not only provide eye catching features but could easily provide a highly effective application with processing speed that almost rivals any simple web-based application.

(Visited 100 times, 1 visits today)