日期:2014-05-16  浏览次数:20484 次

跨域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;
}
}