简单的记录在页面中停留时间
作者:互联网
var tongTime;
var me = 0;
var cheText = "";
var setImet = "";
function tongji(){
clearInterval(tongTime);
var liuTimes = $("#liuTime").val();//编码
cheText = $("#newCpmc").text();
console.log("监听返回事件成功--"+liuTimes+"--"+me+"--"+cheText);
$.ajax({
type:"post",
url:"/weChat/seeLong/save",
data:{
"CAR_NAME":cheText,
"CPDM":liuTimes,
"SEE_TIME":me,
"CAR_TYPE":'@carMap.get("CPMC")'
},
success:function(data){
console.log("成功了"+data.status);
}
});
}
tongTime=setInterval(function(){
for(i=0;i<me;i++){
console.log(me);
}
if(me === 1800){
clearInterval(tongTime)
}else{
me=me+1;
return me;
}
},1000)
window.addEventListener("popstate",function(e){
tongji()
},false)
标签:me,function,停留时间,cheText,记录,var,console,tongTime,页面 来源: https://www.cnblogs.com/wuzhaoyu/p/12173260.html