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 += ''; } } strinfo = ''+str+''; tr += strinfo; } document.getElementById("infoTab").innerHTML = tr; } // // 获取指定文件夹路径下所有图片的URL数组 // console.log(ccc); // xhr.open("PUST", "",false); // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); // xhr.onreadystatechange = function () { // if (xhr.readyState === 4 && xhr.status === 200) { // console.log("send succsess"); // } // }; // xhr.send("sendtophp="+ccc);