One minute
Prototype Cheat Sheet
👴 Careful You’re reading an old article ! Some links might be broken and content may be outdated
I had to deal with Prototype while working with Magento. Here’s a little cheat sheet of some very simple stuff I had to do.
Make an Ajax Request with parameters
new Ajax.Request(url, {
method:'get',
params : { data1 : 'myParam' }
onSuccess: function(xhr){
console.log(xhr.responseText);
var json = JSON.parse(transport.responseText);
}
});
Change value of an input
$('ID OF THE ELEMENT').setValue('The new value');
Change data within a span tag
$('ID OF THE ELEMENT').update('Your new data');
Read other posts