Premier affichages OK
This commit is contained in:
parent
0a6ac31204
commit
d001b21ef7
3
ajax.php
Normal file
3
ajax.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
echo json_encode(array('section' => $_POST['section'], 'pre' => 'Woooohou !'));
|
@ -27,3 +27,9 @@ pre {
|
|||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
background-image: url(../img/ajax-loader.gif);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
BIN
img/ajax-loader.gif
Normal file
BIN
img/ajax-loader.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -12,8 +12,6 @@ global $servers;
|
|||||||
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
|
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" src="js/app.js"></script>
|
<script type="text/javascript" src="js/app.js"></script>
|
||||||
<script type="text/javascript">
|
|
||||||
</script>
|
|
||||||
<title>Git Control Center</title>
|
<title>Git Control Center</title>
|
||||||
</head>
|
</head>
|
||||||
<body data-spy="scroll">
|
<body data-spy="scroll">
|
||||||
|
21
js/app.js
Normal file
21
js/app.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
window.addEventListener('load', function() {
|
||||||
|
var sections = document.querySelectorAll('section');
|
||||||
|
for (var i = 0; i < sections.length; i++) {
|
||||||
|
callRequest(sections[i].id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function callRequest(section) {
|
||||||
|
var pre = document.querySelector('#' + section + ' pre');
|
||||||
|
pre.innerHTML = '<span class="loading">Loading ...</span>';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('POST', 'ajax.php');
|
||||||
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.send('section=' + section);
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
|
||||||
|
var data = JSON.parse(xhr.responseText);
|
||||||
|
pre.innerHTML = data['pre'];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user