Mar 24, 2010

AJAX is a PAIN

I just posted on about the great stuff I was finding on XML.com. I found something else that will be of interest to all of us here.

Bruce Perry posted a blog about using a open source Javascript library called Prototype. Why did he do this? Here are his own words on the subject.

"Why didn't I just create a plain old JavaScript object (POJO) for my application, instead of introducing an open source library? For one, Prototype includes a nifty collection of JavaScript shortcuts that reduce typing and help avoid the reinvention of the wheel. The commonly touted shortcut is $("mydiv"), which is a Prototype function that returns a Document Object Model (DOM) Element associated with the HTML tag with id "mydiv". That sort of concision alone is probably worth the cost of setting up Prototype. It's the equivalent of:
document.getElementById("mydiv");

Another useful Prototype shortcut is $F("mySelect"), for returning the value of an HTML form element on a web page, such as a selection list. Once you get used to Prototype's austere, Perlish syntax, you will use these shortcuts all the time. Prototype also contains numerous custom objects, methods, and extensions to built-in JavaScript objects, such as the Enumeration and Hash objects (which I discuss below).

Finally, Prototype also wraps the functionality of XMLHttpRequest with its own Ajax.Request and related objects, so that you don't have to bother with writing code for instantiating this object for various browsers."


He goes on to SHOW YOU how to set up your files for using prototype by adding certain lines of code and files. And finally he finishes up the blog with examples on how to use the library.

1 comment:

  1. I wish I would have seen this before I got frusrtrated. I tried to Google my issues as well as put them into Yahoo and I found nothing. I guess these blogs do have the ability to help everyone but only if we read them in a timely manner.

    ReplyDelete