Skip to content

Instantly share code, notes, and snippets.

@dusta
Created July 17, 2018 12:17
Show Gist options
  • Save dusta/209bb10b98c2fb040e7a9eb54d3d4592 to your computer and use it in GitHub Desktop.
Save dusta/209bb10b98c2fb040e7a9eb54d3d4592 to your computer and use it in GitHub Desktop.
<div class="container">
<h1 class="font-header">Server Monitor</h1>
<p class="lead">Service <small>List</small> </p>
<table class="table">
<thead>
<tr>
<td>Nazwa</td>
<td>Opis</td>
</tr>
</thead>
<tbody class="list">
</tbody>
</table>
</div> <!-- /container -->
<script src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
const list = $('.list');
let tmp;
$.ajax({
url: "{$urls.services}",
method: 'GET',
data: {},
success: function(response){
if (response.code == "200") {
tmp = '<tr>'+
'<td>Serwer</td>'+
'<td>Opis</td>'+
'</tr>';
} else {
console.log('error');
}
},
error: function(respone){
tmp = '<tr>'+
'<td colspan="2">Wystąpił Problem</td>'+
'</tr>';
}
}).always(function() {
// Render Table
list.html(tmp);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment