2 Javascript libraries that I use all the time are: prototype and scriptaculous.
Prototype make things like ajax calls a breeze. Look at how easy it becomes:
var ajax = new Ajax.Request(url,{
method: 'post',
parameters: params,
onLoading: function(){$('workingMsg').show()},
onLoaded: $('workingMsg').hide()},1000)
});
that’s it!. Here i’m posting an ajax call to the url (set in the variable url before this), posting the params (again set before). It will show the hidden div with the id of workingMsg while it is posting and hide it when its done. It will work in all browsers. Simple.
Also notice the following line:
$(‘workingMsg’)
that alone is the same as the document.getElementById() and it works in all browsers as well. Save a lot of typing.
scriptaculous is a library of functions for javascript effect and neat things like letting you drag and drop to order items with a list. It uses the above protype library. (which is what turned me on to it in the first place).
Lets say you have a list, styled however you like, with the id of productlist. This is all you need write to turn it into a drag and drop ordering list.
Sortable.create(‘productlist’,{scroll: window,scrollSpeed: 40,scrollSensitivity: 20});
I’ve used some options above to tell it to scroll the window when you try to drag and drop outside of what’s currently viewable. There all sorts of options and other great things you can do.
To wrap it all up, if you use Javascript and want to do neat Ajax and visual effects and you are not using the above two libraries, you need to start using them now.