-1
이런 상황에 대해 아약스 요청을 작성할 수있는 사람이 있습니까? ok id를 클릭하면됩니다. 난 단지 그것의 내용을 업데이 트하고 데이터베이스에 저장 싶어요. 아무도 여기에서 나를 도울 수 있기를 바랍니다. 고맙습니다.jQuery를 사용하는 AJAX POST 요청
파일보기 :
<tbody>
<?php foreach ($ds_name as $dsname): ?>
<tr>
<td><div class="text-infoo<?= $dsname->id ?>"><?= $dsname->name ?></div></td>
<td>
<a href="#" id="edit<?= $dsname->id ?>"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="#" id="ok<?= $dsname->id ?>"><span class="glyphicon glyphicon-ok"></span></a>
<a href="#"><span class="glyphicon glyphicon-remove"></span></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php foreach ($ds_name as $dsname): ?>
$('#edit<?= $dsname->id ?>').click(function() {
var text = $('.text-infoo<?= $dsname->id ?>').text();
var input = $('<input id="attribute<?= $dsname->id ?>" type="text" data-id="<?php echo $ds_content->id; ?>"value="' + text + '" />');
$('.text-infoo<?= $dsname->id ?>').text('').append(input);
input.select();
input.blur(function() {
var text = $('#attribute<?= $dsname->id ?>').val();
$('#attribute<?= $dsname->id ?>').parent().text(text);
$('#attribute<?= $dsname->id ?>').remove();
});
$('#edit<?= $dsname->id ?>').hide();
$('#ok<?= $dsname->id ?>').show();
});
<?php endforeach; ?>