동일한 파일에 모달로 JS 함수로부터 데이터를주고 내가 데이터내가 JS 함수에 선언 3 개 변수를 가질
JS 표시 내 모달로 보낼 :
function consulter_salle(id)
{
$.ajax({
url : "<?php echo site_url('index.php/batiment/list_salle')?>/"+id,
type: "POST",
dataType: "JSON",
success: function(data)
{
var table_header = "<table>";
var table_footer = "</table>";
var html ="";
for (var row in data)
{
html += "<tr><td>"+ data.id+"</td><td>"+data.libelle +"</td></tr>";
}
$('#modal_list').modal('show'); // show bootstrap modal when complete loaded
$('.modal-title').text('Test');
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error displaying data');
}
});
}
을 내 모달 :
<div class="modal fade" id="modal_list" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">Liste des salles</h3>
</div>
<div class="modal-body form">
<form action="#" id="form" class="form-horizontal">
<div class="form-body">
</form>
</div>
<div class="modal-footer">
<button type="button" id="btnSave" onclick="save()" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</body>
</html>
데이터 내가 내 컨트롤러에 의해 보냈 목록이며, 데이터를 받았습니다 것으로 확인 된,하지만 난 모달로 보낼 수있는 방법을 찾을 수 없습니다. 모달 - 본문 섹션에 쓸 내용이 궁금합니다! 감사합니다.
'$ ('. 모달 제목'). 텍스트 ('테스트') '이 작동합니까? 그렇다면,'modal-body'에서'.html'을 할 수 있습니다. – Roljhon
이것은 내가 왜 변수에 쓰여졌는지 보여 주므로, .text를 대체하는 함수가 있는지 추측하고 있습니다. ?? –
'.html'이이를 처리합니다. – Roljhon