Files
openfoodnetwork/public/assets/admin/orders/edit_form.js
Andrew Spinks cd1938a74e spree install.
2012-03-27 11:06:49 +11:00

19 lines
567 B
JavaScript

$.each($('td.qty input'), function(i, inpt){
$(inpt).delayedObserver(function() {
var id = $(this).attr('id').replace("order_line_items_attributes_", "").replace("_quantity", "");
id = "#order_line_items_attributes_" + id + "_id";
jQuery.ajax({
type: "POST",
url: "/admin/orders/" + $('input#order_number').val() + "/line_items/" + $(id).val(),
data: ({_method: "put", "line_item[quantity]": $(this).val()}),
complete: function(resp){
$('#order-form-wrapper').html(resp.responseText);
}
});
}, 0,5);
});