Commit c2655ff8 authored by Jogi Hofmüller's avatar Jogi Hofmüller

Update gg3frontend.js

parent 21ff1f77
......@@ -3,7 +3,8 @@
var url = 'https://plagi.at:8888/get';
// function next() {
// jquery/ajax version
// function nextgeruecht() {
// $.ajax({
// type: 'GET',
// datatype: 'json',
......@@ -22,17 +23,29 @@ var url = 'https://plagi.at:8888/get';
// }
function nextgeruecht() {
fetch(url)
.then((resp) => resp.json())
fetch(url, {
credentials: 'omit'
})
.then(function(response) {
if (response.ok) {
return response.json();
}
throw new Error('Network error (response not ok)');
})
.then(function(data) {
document.getElementById('geruecht').innerHTML = data.payload;
})
.catch(function(error) {
document.getElementById('geruecht').innerHTML = 'API Fehler: ' + error;
console.log('API error: ' + error);
})
}
nextgeruecht();
window.onload = function() {
nextgeruecht();
};
// function addgeruecht() {
// var obj = new Object();
// obj.value = $('#newgeruecht').val();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment