この値を取得したい
name="商品' + カウンター + '"
クリックして追加すると動的な値になり、別の行が作成されます。この動的な値を取得する方法と、サーブレットに渡す方法とサーブレットに取得する方法を教えてください。私はフォーム送信を使用しています:JSPおよびJAVA環境。
$("#addrow").on("click", function () {
counter++;
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" name="product' + counter + '"/></td>';
cols += '<td><input type="text" name="price' + counter + '"/></td>';
cols += '<td><input type="text" name="qty' + counter + '"/></td>';
cols += '<td><input type="text" name="linetotal' + counter + '" readonly="readonly"/></td>';
cols += '<td><a class="deleteRow"> x </a></td>';
newRow.append(cols);
alert(cols);
$("table.order-list").append(newRow);
});