From f3bf2467bd064cc36e87c81308bcda1434881193 Mon Sep 17 00:00:00 2001 From: Val <35149642+vkservicesllc@users.noreply.github.com> Date: Wed, 7 Nov 2018 16:45:02 -0500 Subject: [PATCH] Update jsonCap.js --- ajax-requests/js/jsonCap.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ajax-requests/js/jsonCap.js b/ajax-requests/js/jsonCap.js index f70fb22..de57652 100644 --- a/ajax-requests/js/jsonCap.js +++ b/ajax-requests/js/jsonCap.js @@ -3,7 +3,9 @@ console.log('jsonCap.js has loaded...'); function captureJSON() { var xhr = new XMLHttpRequest(); xhr.onload = function() { - var div = document.getElementById('capturedJSON'), + var btn = document.getElementsByTag('button')[0], + btnTxt = btn.textContent, + div = document.getElementById('capturedJSON'), content = '', check = div.innerHTML == content; if (check) { @@ -20,11 +22,13 @@ function captureJSON() { content += '' + respObj[i].Title + ''; if (i == len) content += ''; } + btnTxt = btnTxt.replace('capture', 'hide'); } else { console.log('Connection to Server succeeded. Content was not received due to error.'); } } div.innerHTML = content; + btn.textContent = btnTxt; }; xhr.open('GET', 'files/jsonData.json', true); xhr.send();