First Commit
This commit is contained in:
40
html/sternwarte/javascript/index.js
Normal file
40
html/sternwarte/javascript/index.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// Javascript-Part für index.php (Home-Page)
|
||||
(async function() {
|
||||
const url = 'DB4js.php';
|
||||
|
||||
console.log("komme in das Script");
|
||||
|
||||
// Von der Datenbank Werte abholen
|
||||
// Param:
|
||||
// body: Object mit cmd und param
|
||||
// Return:
|
||||
// angeforderte Daten als JSON
|
||||
const fetchFromDbase = async (body) => {
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/js'},
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
let maintenance = await fetchFromDbase({cmd: 'GET_MAINT'});
|
||||
|
||||
let dialogMaint = $('#maint').dialog({
|
||||
autoOpen: false,
|
||||
open: function () {
|
||||
$(this).load('maintenance.html', function () {
|
||||
});
|
||||
},
|
||||
width: 700,
|
||||
height: 200,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
position: {my: 'center top+30%', at: 'center top+20%'},
|
||||
});
|
||||
|
||||
if (maintenance == true) {
|
||||
dialogMaint.dialog('open');
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user