至于使用JavaScript只发送修改的数据:
第1步:发出原始值
<input type="hidden" id="price1_original" value="3.5" />
<input type="text" id="price1" class="price" value="3.5" />
步骤2:在形式提交处理程序中,仅选择那些改变
changed = $('.price').filter(function() {
var original = $('#' + this.id + '_original').val();
return this.val() != original;
});
步骤3:准备并发送AJAX请求
$.post('/change_price.php', {prices : data}, function(response) {
// handle response
});
第4步:获利! :-)
UPD:另一种解决方案是在用户更改某个值并将焦点转移到别处时立即发送更改。
$('.price').change(function() {
// validate input
// post this single price change to server
});
是分页的产品清单的一个选项,所以你只有每页100个产品? – codeling 2011-12-16 10:55:58
可以但我不想。 – bikey77 2011-12-16 10:56:36
您也可以使用javascript来发布已更改的内容。 – 2011-12-16 10:57:53