Prototype – Cheat Sheet

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');

 


Django Cheat Sheet

Here are couple of useful commands / tutorials (in french sorry!) to get started easily with Django.

Create a project

django-admin.py startproject <project_name>

Manually create a subfolder for HTML templates

Running servers

python manage.py runserver

Create an application (inside of a project)

python manage.py startapp blog

 

You should also read the Django course of Open Classrooms   to get started smoothly 🙂