adding timeout to backend ajax
This commit is contained in:
@@ -6,17 +6,16 @@ $('#update').click(function () {
|
|||||||
// jQuery event binder
|
// jQuery event binder
|
||||||
|
|
||||||
function updateData () {
|
function updateData () {
|
||||||
// download data from backend into obj
|
|
||||||
const url = 'http://' + window.location.hostname + ':5000/data';
|
const url = 'http://' + window.location.hostname + ':5000/data';
|
||||||
// I understand how bad this line looks. Please don't judge me...
|
$.ajax({ // spawn an AJAX request
|
||||||
$.get(url, function (data, status) { // standard jQuery AJAX
|
url: url,
|
||||||
globalObject = data;
|
success: function (data, status) { globalObject = data; },
|
||||||
})
|
timeout: 2500 // this should be a pretty sane timeout
|
||||||
.done(function () {
|
}).done(function () {
|
||||||
fillTable(globalObject, $('#specter'));
|
fillTable(globalObject, $('#specter'));
|
||||||
graphSpectralData(globalObject, $('#spectrogram'));
|
graphSpectralData(globalObject, $('#spectrogram'));
|
||||||
fillLuxUv(globalObject, $('#luxuv'));
|
fillLuxUv(globalObject, $('#luxuv'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillTable (obj, dom) {
|
function fillTable (obj, dom) {
|
||||||
|
|||||||
Reference in New Issue
Block a user