Bootstrap Modal Remote
Demonstrates loading remote data into a Bootstrap Modal. SO: http://stackoverflow.com/q/12152101/570918
by Fadly_Dzil_Massere
HTML
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.0/css/bootstrap.min.css">
<a data-target="#myModal" id="testBtn" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
<div class="modal hide fade" id="myModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h2>Konfirmasi Perubahan Status Request</h2>
</div>
<div class="modal-body">
<div class="controls" id="chekboxes">
<table>
<tbody>
<tr>
<td>
<label class="control-label">Kind Of Complaint :</label>
</td>
<td>
<div class="control-group">
<div class="controls" id="chekboxes">
<label class="checkbox inline">
<input type="checkbox" name="request[]" id="Login" value="Login" />Login</label>
<label class="checkbox inline">
<input type="checkbox" name="request[]" id="Printer" value="Printer" />Printer</label>
<label class="checkbox inline">
<input type="checkbox" name="request[]" id="Monitor" value="Monitor" />Monitor</label>
<label class="checkbox inline">
<input type="checkbox" name="request[]" id="Computer" value="Computer" />Computer</label>
<label class="checkbox inline">
<input type="checkbox" name="request[]" id="Network" value="Network" />Network</label>
<label class="checkbox...
JavaScript
$.ajax({
url: '/echo/html/',
type: 'POST',
data: {
id: "123"
},
dataType: 'json',
success: function (obj) {
var keluhan = "Test";
var jenis_request = "Login, Printer, Monitor";
var jr = jenis_request.split(",")
for (var j in jr) {
$('input[type=checkbox][value=' + jr[j] + ']').prop('checked', true);
}
$('#modalkeluhan').val(keluhan);
$('#myModal').modal('show');
}
});