This is part two of my introductory Javascript videos. I cover how more about using Event Listeners in with the prototype javascript framework. I also try and answer the question: "What is an Event Listener?" and try and provide a simple example of doing an asynchronous call.
Unlike most AJAX samples, this example doesn't require any server-side scripting or even a webserver.
Two notes about the video;
- It's not necessary to capture elements in Event.observe using $()
e.g. Event.observe('myHelloLink' ...) instead of Event.observe($('myHelloLink') ... );
- Instead of using innerHTML, you can also use .update("text changed on Load");
Enjoy!
{ 2 comments… read them below or add one }
Thank you for taking the time to put this together. I am currently learning this framework on the job. What I really appreciate is that while it appears that you make errors while coding, you also show how you recover from those errors. That comes in just as handy as learning the Prototype API.
Thank you!
BMF
Hi BMF,
Thanks for the feedback! I don’t edit out my mistakes because in my own coding, I’ve found that looking at other people doing screencasts, that’s where I find the most learning, is when I’m learning with someone else.
Ayende is a good example of this (he’s an incredible C# coder, he’s confident enough in his work not to edit out minor bumps along the way).
Regardless, programming should be done in iterations. I think a good app will undergo refinement and it should be expressed in the learning as well.
Thanks for watching!