Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home AJAX Plugins
 

Dojo XHR Plug-ins

 

Dojo XHR Plug-ins is a remarkable feature offered by the framework for Ajax based applications. As a plug-in, developers can create a generic add-on for an application and still be able to transport the same plug-in on other Ajax based applications.


Generally, a plug-in could be a simple data retrieval tool, but as already indicated, your plug-in is XHR (XMLHttpRequest) which is one of the most important tools in an Ajax based applications. XHR is usually the main function of the application but with the help of Dojo, this very important part of Ajax based applications can be loaded through simple plug-in.


Not an Easy Challenge


But launching Dojo XHR Plug-in is not an easy task. Remember that the plug-in is still an XHR which will require constant connection with client side as well as the data source. Launching this function as a plug-in increases the possibility of incompatibility with an application. Unless the plug-in was specifically created for the application, the XHR plug-in might never work as expected.


On the other hand, there is a way how to ensure compatibility with most Ajax based applications. There is actually a way for developers to improve customization of their plug-in.


Working with HandleAs


The "loophole" where developers can customize the experience in their plug-in is the simple function called handleAs. This function allows developers improve the callback process to the client side.


The drawback of default handleAs is that it specifies data format it will be using. It will inform developers that they are limited to standard data format for Ajax and JavaScript based applications.


This specification will actually lead you to customization. While it looks like it will prevent customization because it only allows certain formats, handleAs only specifies where these data format should be loaded. If you can change the location where the data should be loaded, you are free to customize your plug-in.


Working with JSON


When you customize the experience of a plug-in, you should expect a little bit of a trade-off in performance. Remember that you are trying to make some changes in the plug-in against its specifications. This means some codes and functions that you'll add in XHR might not be interpreted fast.


But optimization is possible if you follow certain techniques:


1. Focus on data transport only - an XHR Plug-in should be mainly used for data transport. But it is highly recommended to use the plug-in to solely focus on data transport. The interpretation of browsers on the plug-in will be faster which will naturally lead to faster applications.


2. Use JSON - you can use a data format you prefer in working with the plug-in. But don't expect that the plug-in will work at the same speed if you use various data formats. To ensure that the plug-in is optimized in performance, use JSON. Since JSON is the standard data format for JavaScript and Ajax based applications, it's just natural to expect that the optimized plug-in will use JSON.


An XHR plug-in from Dojo is a small but very important tool that could be added in an application. Optimize the users experience by focusing on data and JSON format.



Read Next: Google Chrome Frame



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links