im trying to update all fields, but seem it didnt work? is there anything wrong in the code?
<tr id="1"><td><input type="text" id="pro_1"><input type="text" id="sales_1"></td></tr> //
<tr id="2"><td><input type="text" id="pro_2"><input type="text" id="sales_2"></td></tr> //
<tr id="3"><td><input type="text" id="pro_3"><input type="text" id="sales_3"></td></tr> //
$('#save_products').live('click',function() {
var $inputs = $('#form').find("input[type=text]");
$inputs.each(function(){
var counter = $inputs.length;
var pro_id = $(this).closest.parent("tr").pro_id; //<--
var pro_value = $(this).find('pro_'+pro_id).attr("value");
var sales_value = $(this).find('sales_'+pro_id).attr("value");
$.post("include/setting.php?save",{id:pro_id, pro_value:pro_value, sales_value:sales_value, count:counter}, function(data){
if(data.success) {
$('.err_message').html(data.message).addClass('ok').fadeIn('slow');
} else {$('.err_message').html(data.message).addClass('error').fadeIn('slow');}
},"json");
})
return false;
});