Questo non sta davvero passando valori. Sta solo chiamando una funzione quando si preme un pulsante:
$(document).ready(function() {
$('form').on('submit', function(e) {
e.preventDefault(); // we don't want to submit the form
$('#piechart').each(function() { // only do this if the element is found
// clear the canvas
this.getContext('2d').clearRect(0, 0, this.width, this.height);
});
var angles = [
$('#angle1').val() || 0,
$('#angle2').val() || 0,
$('#angle3').val() || 0
];
piechart("piechart1", ["cyan", "yellow", "green"], angles);
});
});
val()
ottiene il valore del input
elemento. Noi facciamo || 0
per impostarlo su 0
Nel caso in cui il browser non capisca type="number"
e ci manda una stringa vuota.