$('#production_1, #production_2, #production_3, #production_4').submit(function (e) {
e.preventDefault();
var data = $(this).serialize();
var defaultAlert = $('#alert_production').html();
$.ajax({
cache: false,
type: this.method,
url: this.action,
data: data,
success: function (alert) {
$('#alert_production').html(alert).fadeOut(3000, function () {
$(this).html(defaultAlert).show();
});
}
});
});
$('#production_1, #production_2, #production_3, #production_4').submit(function (e) {
e.preventDefault();
var data = $(this).serialize();
var originName = e.target.id;
var idFromName = originName.split('_')[1];
var defaultAlert = $('#alert_production_' + idFromName).html();
$.ajax({
cache: false,
type: this.method,
url: this.action,
data: data,
success: function (alert) {
$('#alert_production_' + idFromName).html(alert).fadeOut(3000, function () {
$(this).html(defaultAlert).show();
});
}
});
});
$('#production_1, #production_2, #production_3, #production_4').submit(function (e) {
e.preventDefault();
var data = $(this).serialize();
var target = $('#alert_'+$(this).attr('id'));
var defaultAlert = $(target).html();
$.ajax({
cache: false,
type: this.method,
url: this.action,
data: data,
success: function (alert) {
$(target).html(alert).fadeOut(3000, function () {
$(this).html(defaultAlert).show();
});
}
});
});