var test=document.getElementById('abc'); var ajaxGet = function (url, callback) { var callback = (typeof callback == 'function' ? callback : false), xhr = null; try { xhr = new XMLHttpRequest(); } catch (e) { try { ajxhrax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } } if (!xhr) return null; xhr.open("GET", url,true); xhr.onreadystatechange=function() { if (xhr.readyState==4 && callback) { callback(xhr.responseText) } } xhr.send(null); return xhr; } var stuff; ajaxGet( 'https://bleutrade.com/api/v2/public/getmarkets/', function (response) { response = JSON.parse(response); if (!response) return; stuff=response.result; }); var i=0; var name; for(i = 0; i <1000; i++) { test.innerHTML+=(stuff[i].MarketName+'
'); // outputs an id name=stuff[i].MarketName; }