Archive for December 28th, 2007

+1 Point for Prototype

Friday, December 28th, 2007

I just replaced 4,650 lines of javascript with this

var myRequest = new Ajax.Request(’ajax/get_product_data.php?’, {
method: ‘get’,
parameters: ‘product_id=’+$F(’product_list’),
onSuccess: function(transport) {
var product_data = transport.responseText.evalJSON();
$(’category_list’).value=product_data.product_category;
$(’unit_cost’).value=product_data.unit_cost;
}
});

You read that correctly - 4,650 lines.

Powered by ScribeFire.