ActiveXObject对象连续发送请求问题
function writeLog(ctx,strFile ,handleType)
{
??? var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
??? var fileSize=Math.round(getFileSize(strFile)/1024 * 100) / 100.00;
??? var url = ctx + "/include/writeSaveLog.jsp?r="+Math.random()+"&moduleName=" + moduleName
??????????? + "&handleType=" + handleType+"&fileSize="+fileSize;
??? httpGet(xmlhttp, url);
}
function httpGet(http, url)
{
??? var strRet = "";
??? if (url.length != 0)
??? {
??????? http.open("GET", url, false);
??????? http.send(null);
??????? strRet = http.responseText;
??????? strRet = strRet.replace("\r", "");
??????? strRet = strRet.replace("\t", "");
??????? strRet = strRet.replace("\n", "");
??????? strRet = strRet.replace("\b", "");
??????? strRet = strRet.replace(" ", "");
??? }
??? if (strRet.length == 0)
??? {
??????? return "";
??? }
??? return strRet;
}
当不断向后台发送请求时 如果 url? 不变 他不会再向后台发送请求,解决办法 增加一个随机参数 r="+Math.random()+"&