Update jsonCap.js

This commit is contained in:
Val
2018-11-07 16:22:53 -05:00
committed by GitHub
parent ffba87ed87
commit 2aced40620

View File

@@ -1,18 +1,16 @@
console.log('jsonCap.js is running...'); console.log('jsonCap.js has loaded...');
function captureJSON() { function captureJSON() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onload = function() { xhr.onload = function() {
var div = document.getElementById('capturedJSON'), var div = document.getElementById('capturedJSON'),
content = '', content = '',
check = div.innerHTML === content; check = div.innerHTML == content;
console.log(check);
if (check) { if (check) {
if (xhr.status >= 200 && xhr.status < 400) { if (xhr.status >= 200 && xhr.status < 400) {
var respObj = JSON.parse(xhr.responseText), var respObj = JSON.parse(xhr.responseText),
len = respObj.length, len = respObj.length,
i; i;
console.log(xhr.responseText);
content += '<table><tr><th>Company</th>'; content += '<table><tr><th>Company</th>';
content += '<th>First Name</th><th>Last Name</th><th>Title</th></tr>'; content += '<th>First Name</th><th>Last Name</th><th>Title</th></tr>';
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {