<script>
function viewtopic(paymoney,_aid){
var dia=$.dialog({
title:'<center>查看权限</center>',
select:0,
content:'<center><p style="color:red;margin-top:5px;">支付'+paymoney+'积分</p></center>',
button:["确认支付","取消"]
});
dia.on("dialog:action",function(e){
if(e.index==1){
return false;
}
var _tid=_aid;
$.ajax({
type:"POST",
url:"{url}",
data:{tid:_tid},
datatype: "text",//"xml", "html", "script", "json", "jsonp", "text".
success:function(data){
data=$.trim(data);
if(data==2){
alert('先登录!');
}
if(data==1){
window.location.reload();
}
} ,
error: function(){
//请求出错处理
}
});
// console.log(e.index)
});
dia.on("dialog:hide",function(e){
// console.log("dialog hide")
});
}
</script>
用的zepto.min.js,用户点击确认会出现同时2次的请求,导致每次都消耗2次积分。请问有没有什么办法可以限制同时重复的2次请求,在服务处理没用,是同时插入数据库,都没法做判断。