Matt McDonald’s Website

+1 Point for Prototype

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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>