From d001b21ef73e7596ee9111f74cb8961a9c226cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xe=CC=81fir=20Destiny?= Date: Wed, 2 Oct 2013 12:21:30 +0200 Subject: [PATCH] Premier affichages OK --- ajax.php | 3 +++ css/styles.css | 6 ++++++ img/ajax-loader.gif | Bin 0 -> 1849 bytes index.php | 2 -- js/app.js | 21 +++++++++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 ajax.php create mode 100644 img/ajax-loader.gif create mode 100644 js/app.js diff --git a/ajax.php b/ajax.php new file mode 100644 index 0000000..ff38f36 --- /dev/null +++ b/ajax.php @@ -0,0 +1,3 @@ + $_POST['section'], 'pre' => 'Woooohou !')); diff --git a/css/styles.css b/css/styles.css index 5d46a36..292fd5c 100644 --- a/css/styles.css +++ b/css/styles.css @@ -27,3 +27,9 @@ pre { padding-top: 8px; margin-top: 10px; } + +.loading { + background-image: url(../img/ajax-loader.gif); + background-repeat: no-repeat; + padding-left: 20px; +} diff --git a/img/ajax-loader.gif b/img/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b33f7e54f4e55b6b8774d86d96895db9af044b4 GIT binary patch literal 1849 zcma*odr(tX9tZI2z31lM+(&YVk%mZ}5P~KlG2s=WSbGzm0!x7^P##Mnh7t-jP!X0Q zk_SQ}Po-L1tlDK;6l?(>v)e5ZBQx4|Y-Q?nr@Px3?9h(3ZWr3^tj=`TP57gKr87N$ zp2wWee1GRRCwo_xahnw)5cxNPJbCg2L6DV|6`#+yw6v6!mDS$f9-JvFD^n;GQ&UrZ zzh5jCkByB101O60U0q#p_1BM>Cv-vP?&s4@g_((4_1L=L$(a91)0=J91Gas#R{McE znYG^9*0A5YZ>#;~+Wkn(W5B0^yELIYLP!K}mB~<)AM@1&nqekynuaEGqPrzoH|KodRXJy)%+w_fu3nE5>@Bd_b zqC$EQ;{c`T&?EsNO|igL9gC7Ygxv?aQUEXMq?~>wg{EyW;VcJ37CUF#HjrT=KQO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/index.php +++ b/index.php @@ -12,8 +12,6 @@ global $servers; - Git Control Center diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..63dc4c0 --- /dev/null +++ b/js/app.js @@ -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 = 'Loading ...'; + 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']; + } + }; +}