var imgPath; var xhr1 = new XMLHttpRequest(); xhr1.open("GET", "imgPath.txt?t="+Math.random()*100000,false); xhr1.onreadystatechange = function () { if (xhr1.readyState === 4 && xhr1.status === 200) { imgPath = xhr1.responseText; } }; xhr1.send(); console.log(imgPath); var ccc = "============"; var xhr = new XMLHttpRequest(); var originalSendMethod = xhr.send; xhr.open("GET", "keywords?t="+Math.random()*100000,true); xhr.send = function (arge,fn) { this.onreadystatechange = function () { if (xhr.status === 200) { fn(arge,xhr.responseText); } }; originalSendMethod.call(this,arge,fn); }; xhr.send(imgPath,callball_fun); function callball_fun(arge,ccc){ var infoArr = ccc.split("####"); var tr = ""; var imgArr = arge.split("|"); for(j = 0;j < 3;j++) { str = ""; if( j == 7 ) { for(i=0;i<3;i++) { str += "
"; } } else { for(i=0;i<3;i++) { let v = infoArr[parseInt(Math.random()*(infoArr.length-1))]; str += '