Mootools
From RISDpedia
Moo tools is an object based JavaScript framework.
[edit] Examples
Everything needs to be put in the following. This will make sure all the code does not fire until the DOM is ready.
window.addEvent('domready', function(){ //code here });
//new instance of the request(ajax) class var myRequest = new Request({ url: 'getImages.php', // url to reqest onSuccess: function(txt){ //on success of the ajax call do this $('imageWrapper').set('html', txt); // set the div with ID imageWrapper to the output of the ajax call } }); myRequest.post({'name': variable}); // make the ajax call and send $_POST['name'] = variable to variable //------------------------------------------------------------------------------- you can refer to an id like so $('IDname') you can refer to a class like so $$('.CLASSname') //------------------------------------------------------------------------------- $$( '.setWrapper' ).addEvent('click', function(e) { //fire when any element with the class "setWrapper" is clicked on $('imageWrapper').empty().addClass('ajax-loading'); // remove everything from the div ID imageWrapper and add the class to it called ajax-loading $('imageWrapper').set('html', '<h1 style="text-align:center;">Loading Images...<h1>'); // add this html to imageWrapper var album = this.getProperty('id'); //variable album is equal to the ID(css/html) of the element clicked on. //EG. if you clicked on <a class="setWrapper" id="test" /> then album will be equal to test myRequest.post({'album': album}); send as a post return false; // do not follow the link });
NOTE: All information contained within this article is pure opinion. Although this article is intended to help students, it may contain faulty or misleading information. This article is not to be considered professional opinion or advice, and is in no way a replacement for reading all safety/instructional documentation. Always remember to protect yourself when handling/using hazardous materials, as well as test new techniques before using them on projects/work intended to be handed in or used.
RISDpedia and its contributers take NO responsibility for the information contained within.
RISDpedia is not an official site of the Rhode Island School of Design.

