When I’ve decided to use AJAX in my framework, I’ve had a lot to do to enable AJAX requests and responses, and actually, a very shiny result I’ve got, that is, I’ve used it and built multiple websites for internal and external networks, and also for the internet, before I faced the truth and realized the trouble I fell in.
Here are some of limits I’ve faced when relying on AJAX:
- You can’t make any file upload or download using just AJAX, instead, many programmers used to add a hidden frame to their web page called HiddenFrame or something similar, and then they target requests of uploading and downloading as normal browser HTTP request to that frame, so they aren’t using AJAX, but for the visitor, it seems to be.
- The multilingual websites will cause some confusion to AJAX programmer while you should receive the text and then find the original charset to translate that text into. Actually, I’ve used a class I’ve found on PHPClasses and written by Khaled AlShamaa to work around this problem.
- The main problem of AJAX which you will not realize until you publish your site to the internet is that search engines will not be able to find results in your website without an advanced modifications you should make to your site.
Actually, you will see this problem a monster which wants to destroy your work when you completely rely on AJAX to navigate from page to other so no link on your pages will start a browser HTTP request/response cycle and will result a complete HTML web page.
To solve this problem, either I used the meta tag to add keywords from the database all to one page, or, I wrote a dynamic page that generates HTML links to real auto-generated HTML pages which contain auto AJAX request to the real content.
Search engines would help in solving this problem if they can read AJAX request links and interpret the XML resulted by the request.
- Your website will not work on almost all mobiles on the globe.
- Debugging is too complicated in AJAX compared to the normal Web Applications.
I am not saying: lets drop AJAX down and reverse back to the normal web applications or use flash technologies instead, it is just an invitation to reconsider all these elements before deciding to use AJAX in most of your application flow.
And I think just to be fair, here I’m listing some of benefits you gain using AJAX:
- quicker application flow
- desktop-like web application
- higher interactivity with visitor
- richer client interface (also requires more powerful hardware)
- smaller page size
- invisible two-direction feedBack
- Lighter load on network
- … more and more …