//Global Mega Options AJAX product submit with validation //Joseph De Araujo 2010 www.alreadymade.com $(document).ready(function() { $('#add_to_cart').removeAttr('onclick'); $('#add_to_cart').click(function () { var submitted = $('#product :input').serialize(); var options = { beforeSend: function() { return $('#product').validate().form(); }, url: 'index.php?route=module/cart/callback', type: 'post', data: submitted, datatype: 'html', success: function (html) { $('#module_cart .middle').html(html); }, complete: function () { var image = $('#image').offset(); var cart = $('#module_cart').offset(); $('#image').before(''); params = { top : cart.top + 'px', left : cart.left + 'px', opacity : 0.0, width : $('#module_cart').width(), heigth : $('#module_cart').height() }; $('#temp').animate(params, 'slow', false, function () { $('#temp').remove(); }); } }; $.ajax(options); }); });