1
これは有料のセルにinput type=text id="class_fee_cell"
があるときに機能していましたが、実際には変更できないセル値が必要ですが、別の料金タイプが選択されます。 これはなぜ機能していないのですか? ( 'form_options'は料金タイプの選択ボックスを作成する関数で、JSONは選択された料金の額を問い合わせます)。テーブルセルを更新するJSON
HTML-(テーブルの同じ行にある2個のセル)
<td id="class_fee_cell">
<?= html($class['class_fee']) ?>
</td>
<td>
<select name="students[<?php echo $i ?>][fee_id]" class="fee_id_select" id="<?php echo $i ?>" style="width: 10em">
<option></option>
<?= form_options($fee_options, array('selected'=>$class['fee_id'])) ?>
<br><br>
</select>
</td>
jQueryの:(JSONが選択料金タイプに基づいて手数料額を取得したが、表の手数料額セルが更新されていません。 )
$(".fee_id_select").live("change",function()
{
var $fee = $(this).closest('tr').find('#class_fee_cell');
jQuery.getJSON('get_fee_json.php',
{
'id': this.value
},
function (data, textStatus)
{
var fee = data || {};
$fee.val(fee.fee_amount || '');
}
);
});
Doh!それを今見て... $ fee.html(fee.fee_amount || ''); ($ fee.valではなく... ありがとうございました! – Jazzy