当前位置: 代码迷 >> JavaScript >> 跨域ajax访问跟js sleep
  详细解决方案

跨域ajax访问跟js sleep

热度:794   发布时间:2012-11-23 22:54:33.0
跨域ajax访问和js sleep

function check(choice,serviceID){
var url="<%=url1%>";
var url2="<%=url2%>";
var stat = document.createElement("<img id='stat' src='"+url2+"'style='display:none;'/>");
var stat2 = document.createElement("<img id='stat1' src='"+url+"'style='display:none;'/>");
document.body.insertBefore(stat);
document.body.insertBefore(stat2);
var opinion= document.getElementById("opinion").value;
opinion=encodeURI(opinion);
opinion=encodeURI(opinion);
var serviceIdName=document.getElementById("serviceIdName").value;
var now = new Date();
var exitTime = now.getTime() +10000;
while (true) {
now = new Date();
if (now.getTime() > exitTime) {
location.href="decisionSubmit.action?serviceID="+serviceID+"&choice="+choice+"&decision="+opinion+"&serviceIdName="+serviceIdName;
return;
}
}

  相关解决方案