diff --git a/data/config.html b/data/config.html index b7f2741..68cfd05 100644 --- a/data/config.html +++ b/data/config.html @@ -18,6 +18,21 @@ +
+ @@ -28,12 +43,14 @@ $(document).ready(function() { // populate each field $('.config-item').each(function() { - el = $(this); - $.get('/rest/config/'+el.data('key')) - .done(function(d) { - el.find('.rest-field').val(d.Value); + let el = $(this); + let key = el.data('key'); + + $.ajax({ method: 'get', url: '/rest/config/'+key}) + .done(function(data) { + $(".config-item[data-key='"+key+"']").find('.rest-field').val(data.Value); }); - }); + }); // respond to button clicks to update $('.config-item button').on('click', function(e,f) { @@ -41,7 +58,11 @@ $(document).ready(function() { val = $(this).parents('.config-item').find('.rest-field').val(); $.post('/rest/config/'+key, { value: val }) .done(function(d) { - alert('Updated config'); + if (d.Success) { + alert('Updated config'); + } else { + alert("Error: " + d.Error); + } }); return false;