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

Frameworks Tutorials

 
Home Frameworks
 

Prototype.js for Easier Ajax Development

 

Planning to develop an efficient Ajax based application is easier with Prototype.js. This framework was developed specifically to simplify almost any Ajax based function. It is MIT licensed framework could easily be integrated to other frameworks.


To start using the framework it has to be referenced first in your webpage. The following code is used to activate prototype.js. Usually this is referenced in an HTML webpage:


<script type="text/javascript" src="prototype.js"></script>


It is fast becoming the preferred library by different developers. With prototype.js, almost every function could be used with three main objects only. So it does not need a lot of training and familiarity to get along with this simple yet highly efficient framework. The three objects in proptype.js are Ajax.Updater, Ajax.Request and Ajax.Responders.


Ajax.Request


This object is used to enable XMLHttpRequest. This object wraps every function including XMLHttpRequest in the application. The best thing about this object is that it does the job of browser compatibility. Wrapping up XMLHttpRequest and its related functions is really easy.


Communication with the server to establish client side communication based on server side script is easier. Since its compatibility is almost assured, it can go directly to the server, passing through the cross-browser compatibility only for a short while.


Ajax.Updater


Ajax.Updater wraps the objects related to functions that could trigger changes in some parts of the webpage. Think of developing an application with Ajax application with ASP.NET’s ControlUpdate. The major difference between these two is the control toolkit is more of a tool instead of a code.


Ajax.Updater uses three parameters: container, url and the additional options for execution. The additional parameter is actually the most important part of the parameter since it specifies which part of the webpage it will be affecting. A variation of Ajax.Updater is Ajax.PeriodicalUpdater. The latter function provides another parameter wherein parts of the webpage will be updated even without the action of the web administrator.


Ajax.Responder


Ajax.Responder strings everything in the webpage. This functionality “listens” to other applications by logging all the activities in the webpage. Using this function, developers could easily point another function that will respond to the log through Ajax.Responder.


You need not develop a highly complicated function as a response to another function. Ajax.Responder is a general listening tool where every action of the webpage is being logged. For your function to respond to the Ajax.Responder, you just have to trigger Ajax.Responder by registering it to the function. Set up a parameter based on the expected response of the function you target and you are on your way.


These three functions essentially wraps up everything that you need to develop an Ajax based website or application. Ajax.Request ensures communication between the server and the client will be faster with cross-browser compatibility. Ajax.Updater and its relative Ajax.PeriodicalUpdater change some parts of the webpage without refreshing the whole website.


Lastly, Ajax.Responder is used to react to other functions within the website. Because of its simplicity and ease of use, prototype.js is one of the easiest to understand and one of the most efficient frameworks specifically made for Ajax developed.



Read Next: OutPost Framework - WebForms and Ajax



 

 

Comments



Post Your Comment:

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

AjaxWith.com Offers

  Blog Hosting

  Web Hosting

  VPS Hosting

  Dedicated Hosting

  Web Conferencing

  Online Backup

  VOIP

 

Sponsored Links