js中的坑
来源:互联网 发布:绝地求生游戏画面优化 编辑:程序博客网 时间:2024/04/30 02:23
原意:本来想实现投屏点下等待结果后再进行下一步的刷新?结果坑了自己
原因有两点:
1
后台可能一直再链接着让ajax无法等到结果其后果是以后无论再那个浏览器上访问都失败就算后台已经截图并且保存到服务器上都不会获取到
其请求总是被取消掉了 (主要出在tcp的服务端的长链接没有断掉总卡在accept方法上)
解决办法
service = new ServerSocket(port);
service.setSoTimeout(3000);
2
js加了boolean判断 想法是让他们总是进行依次点击当有时flag 没有改为true
function send(unique, type, x1, y1, x2, y2, text,robotId) {
var path = "${request.pageContext.contextPath}/cust/forscreen!startForScreen.do";
if(robotId){
path+="?robotId="+robotId;
}
if (flag) {
flag = false;
$.ajax({
url : path,
data:{'unique':unique,'type':type,'x1':x1,'y1':y1,'x2':x2,'y2':y2,'text':text},
cache : false,
async : true,
type : "GET",
dataType : 'text',
success : function (result){
oEn.src="";
oEn.src = result;
flag = true;
},
error:function(result){
flag = true;
},
complete:function(){
flag = true;
}
});
}
};
解决办法在每次点击从新有设置为true
function beginForScreen(robotId){
unique = new Date().getTime();
document.getElementById("myimage22").src="images/open.gif";
document.getElementById('f_screen').style.display = "block";
flag = true;
send(unique,'home',0,0,0,0,null,robotId);
}
- js中的坑
- isNaN在JS中的坑
- JS中的“!!”
- JS中的“!!”
- js中的||{}
- JS中的“!!”
- JS中的“!!”
- JS中的“!!”
- JS中的“!!”
- JS中的!!
- JS中的“!!”
- js中的$
- swiper.js中的坑,你不知道的js
- [js] js中的 set & get
- 【JS】:JS中的array详解
- JS:js中的排序算法
- Atlas中的JS用法
- js 中的dom操作
- 机器学习:Python中如何使用最小二乘法
- Java入门笔记一
- 改善Unity编辑器对Lua文件的支持
- Java多线程中Synchronized简介和Static Synchronized的区别
- 使用git将项目代码上传到gitHub上
- js中的坑
- PTA 整数分解为若干项之和
- BJ模拟(2) D2T3 路径规划
- 第一篇博客
- Linux---将文件复制到虚拟机中
- jQuery入门 --基本概念及选择器的使用
- Core Graphics API 详解
- 深入浅出js
- 解决IDEA不能debug的问题