refactor updateData to use simpler $.get method
This commit is contained in:
@@ -3,15 +3,12 @@ $('#update').click(updateData);
|
|||||||
// jQuery event binder
|
// jQuery event binder
|
||||||
|
|
||||||
function updateData () {
|
function updateData () {
|
||||||
const url = 'http://' + window.location.hostname + ':5000/data';
|
const url = '/data';
|
||||||
$.ajax({ // spawn an AJAX request
|
$.get(url, (data, status) => {
|
||||||
url: url,
|
if (status === '200') {
|
||||||
success: function (data, status) {
|
|
||||||
console.log(data);
|
|
||||||
graphSpectralData(data[0], 0);
|
graphSpectralData(data[0], 0);
|
||||||
fillTableData(data);
|
fillTableData(data);
|
||||||
},
|
} else alert('Data request failed, please refresh page.');
|
||||||
timeout: 2500 // this should be a pretty sane timeout
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user