Top 10 Reasons YOU Need an AJAX Framework
December 11, 2006
You've all seen the tutorials. Make an AJAX application in 20 lines of code! All you need to to is get a request object and send! Now you're ajaxified. Well, not so fast. If you're making a serious application you're going to need a few basics in your framework that will allow you to handle the most common situations. Here are the top 10 reasons you need an ajax framework.
1. Request/Response Syncing - Request A fires from the browser and takes 3 seconds on the server. Request B fires from the browser right after A and only takes 1 second to return. Your request/responses are now out of sync. Can you application handle this? Any decent framework will provide either a submission queue or request/response matching to keep your calls in sync.
2. Network Down Situations - Your webserver probably fails more often than you think. If your request fails or there is a server side error in the return will your application choke? A framework will catch these problems and let you handle them gracefully. There is no need to break your application because the server choked on a request.
3. JSON, XML, TEXT support - JSON is the new hotness. I'd say most of the new ajax development going on uses JSON as the default for transmitting data. It's light, fast and far easier to work with than XML in the browser. A good framework will support JSON natively. A good framework will also NOT use just plain old eval(myjsonstring) to deserialize the JSON string.
4. Forms support - Creating a long string of form values is old school. Be part of the new school with a function such as ajaxObj.getForm('formId') as in MyBic. One function gathers up all your form data, encodes it and lets you send it to the server in a neat little package. Quit doing the heavy lifting.
5. Request Abortion - You should be able to set timeouts on requests on an individual level. Should request A take 10 seconds? Should request B take less than 3? A good framework will auto abort these calls that hang and allow you to handle them gracefully.
6. Built in Debugging - For those who can't use firefox's firebug tool or for those creating kiosk apps who may not have tools available an online debugger is a huge help. A good framework will show you the request/responses on the screen so you can debug your apps easier.
7. Uses the RIGHT XMLHttpRequest Object - Are you checking for the proper version of MSXML for IE? Are you aware that IE only recommends you use version 6.0 and 3.0? 4 and 5 are strictly for office updates and may actually introduce bugs? A good framework will know this for you and fetch the proper object.
8. Memory Leaks - If your code is setting your callback function directly with "onreadystatechange = myfunction" you my friend are a memory leak magnet. A real ajax framework will set a timer out of process to test for the response. This will not bind to a dom element creating a circular reference. A decent framework should be tested daily with memory leak monitoring tools.
9. Helper functions - Most frameworks come with nice little utility functions that help you with things you'll probably need for ajax development. For example, being able to dynamically load javascript/css files at runtime in your applications. Lazy loading functionality.
10. It's someone else's headache! You shouldn't worry yourself with all these things. People are willing to do it for free for you. Why try and re-invent the wheel when you probably haven't thought of everything?
One such framework that supports the 10 above is the MyBic AJAX/PHP framework. 3 files, high quality. http://www.litfuel.net/mybic

1. Request/Response Syncing - Request A fires from the browser and takes 3 seconds on the server. Request B fires from the browser right after A and only takes 1 second to return. Your request/responses are now out of sync. Can you application handle this? Any decent framework will provide either a submission queue or request/response matching to keep your calls in sync.
2. Network Down Situations - Your webserver probably fails more often than you think. If your request fails or there is a server side error in the return will your application choke? A framework will catch these problems and let you handle them gracefully. There is no need to break your application because the server choked on a request.
3. JSON, XML, TEXT support - JSON is the new hotness. I'd say most of the new ajax development going on uses JSON as the default for transmitting data. It's light, fast and far easier to work with than XML in the browser. A good framework will support JSON natively. A good framework will also NOT use just plain old eval(myjsonstring) to deserialize the JSON string.
4. Forms support - Creating a long string of form values is old school. Be part of the new school with a function such as ajaxObj.getForm('formId') as in MyBic. One function gathers up all your form data, encodes it and lets you send it to the server in a neat little package. Quit doing the heavy lifting.
5. Request Abortion - You should be able to set timeouts on requests on an individual level. Should request A take 10 seconds? Should request B take less than 3? A good framework will auto abort these calls that hang and allow you to handle them gracefully.
6. Built in Debugging - For those who can't use firefox's firebug tool or for those creating kiosk apps who may not have tools available an online debugger is a huge help. A good framework will show you the request/responses on the screen so you can debug your apps easier.
7. Uses the RIGHT XMLHttpRequest Object - Are you checking for the proper version of MSXML for IE? Are you aware that IE only recommends you use version 6.0 and 3.0? 4 and 5 are strictly for office updates and may actually introduce bugs? A good framework will know this for you and fetch the proper object.
8. Memory Leaks - If your code is setting your callback function directly with "onreadystatechange = myfunction" you my friend are a memory leak magnet. A real ajax framework will set a timer out of process to test for the response. This will not bind to a dom element creating a circular reference. A decent framework should be tested daily with memory leak monitoring tools.
9. Helper functions - Most frameworks come with nice little utility functions that help you with things you'll probably need for ajax development. For example, being able to dynamically load javascript/css files at runtime in your applications. Lazy loading functionality.
10. It's someone else's headache! You shouldn't worry yourself with all these things. People are willing to do it for free for you. Why try and re-invent the wheel when you probably haven't thought of everything?
One such framework that supports the 10 above is the MyBic AJAX/PHP framework. 3 files, high quality. http://www.litfuel.net/mybic

Charlie says:
December 12, 2006 @ 01:58 — Reply
What's bad about using eval() to parse JSON, provided it's coming from a trusted source? That's basically what the JSON library that MyBic uses does anyway. Am I missing something?
Jim says:
December 12, 2006 @ 07:03 — Reply
hey Charlie, the JSON parser that MyBic uses comes from JSON.org. It basically checks to make sure it's a valid JSON string before it evals it. Instead of just eval'ing any string that could lead to parsing errors, malicious code, etc. Sometimes you might have code that doesn't come from a trusted source. If you use plain eval you could be opening yourself up to xss issues for no good reason. Better safe than sorry.
john beck says:
January 9, 2007 @ 20:54 — Reply
It's going to continue to grow and will definitely still be around for a while. So, in late-night talk show style, I've put together a top 10 list.
Leo says:
January 14, 2007 @ 00:29 — Reply
I dont know but why i don find such informative and profitable blogs so often,I suspect blogging world is becoming so small that we cant find such lucrative blogs like this one.
SEO says:
July 26, 2007 @ 22:16 — Reply
My main concern is that you can't guarantee every page of your website will be included in the SERPs. Considering I'm constantly adding new products to my company's website, I need to be sure that customers can find them as soon as possible.http://www.seoptimizerz.com
tax-pol says:
December 25, 2009 @ 14:56 — Reply
Comment pending moderation
mobiliario says:
January 24, 2010 @ 05:29 — Reply
Comment pending moderation
blu ray ripper says:
April 18, 2010 @ 03:55 — Reply
Comment pending moderation
Hollywood Wallpapers says:
April 18, 2010 @ 18:33 — Reply
Comment pending moderation
sanny says:
May 12, 2010 @ 00:33 — Reply
Comment pending moderation
642-067 says:
May 19, 2010 @ 00:32 — Reply
Comment pending moderation
shopping says:
May 21, 2010 @ 05:25 — Reply
Comment pending moderation
notebook battery manufacturer says:
May 29, 2010 @ 00:18 — Reply
Comment pending moderation
Prozac No Prescription says:
June 3, 2010 @ 10:28 — Reply
Comment pending moderation
virbram five fingers says:
June 4, 2010 @ 20:17 — Reply
Comment pending moderation
Stromlieferant Schleswig Holstein says:
June 7, 2010 @ 05:21 — Reply
Comment pending moderation
Billig Stromlieferant says:
June 7, 2010 @ 05:24 — Reply
Comment pending moderation
Tiffany CO says:
June 7, 2010 @ 18:40 — Reply
Comment pending moderation
MKV to iPad says:
June 9, 2010 @ 00:56 — Reply
Comment pending moderation
LOuIs VuItToN Damier Graphite Canvas says:
June 9, 2010 @ 21:28 — Reply
Comment pending moderation
CT0-101 says:
June 12, 2010 @ 02:28 — Reply
Comment pending moderation
Louis Vuitton handbags says:
June 16, 2010 @ 01:09 — Reply
Comment pending moderation
evening dresses says:
June 18, 2010 @ 09:00 — Reply
Comment pending moderation
air max says:
June 24, 2010 @ 01:36 — Reply
Comment pending moderation
rolex watches says:
June 24, 2010 @ 02:49 — Reply
Comment pending moderation
burberry bags says:
June 26, 2010 @ 02:11 — Reply
Comment pending moderation