diff --git a/ajax-requests/js/jsonCap.js b/ajax-requests/js/jsonCap.js index 8b13789..6f09a09 100644 --- a/ajax-requests/js/jsonCap.js +++ b/ajax-requests/js/jsonCap.js @@ -1 +1,28 @@ - +function captureJSON() { + var xhr = new XMLHttpRequest(); + xhr.onload = funtion() { + if (xhr.status >= 200 && xhr.status < 400) { + var div = document.getElementById('capturedJSON'), + content = '', + respObj = JSON.parse(xhr.responseText), + len = respObj.length, + var i; + console.log(xhr.responseText); + content += '
| Company | '; + content += 'First Name | Last Name | Title |
|---|---|---|---|
| ' + respObj[i].Company + ' | '; + content += '' + respObj[i]['First Name'] + ' | '; + content += '' + respObj[i]['Last Name'] + ' | '; + content += '' + respObj[i].Title + ' |