我正在使用 Intel Appframework 创建 android 应用程序。现在我正在尝试绑定 touchevent,但我看到这会产生冗余的多个 ajax 调用!
这是我的脚本:
$(document).on("doubleTap", ".chatOp a[rel]", function(){
var nomeSuo = $(this).attr('rel');
$.post('http://www.mimanchitu.it/appf/include/chat_con.asp', {M_FROM:localStorage.getItem("nameStorage"),M_TO:nomeSuo},
function(oldChat){
$("#showChat").empty();
$("#showChat").html(oldChat);
return $.ui.loadContent("#chat_con")
});
})
$(document).on("longTap", ".chatOp a[rel]", function(){
var nomeSuo = $(this).attr('rel');
var nomeTuo = localStorage.getItem("nameStorage");
alert("vuoi eliminare?");
$.post('http://www.mimanchitu.it/appf/include/chat_delAll.asp', {from:nomeSuo,to:nomeTuo}, function(){
$("#"+nomeSuo).remove();
});
})
我用它来为双击或长按情况绑定不同的事件!但在所有两种情况下都进行多个 ajax 调用!
为了防止在其他情况下多次调用,我使用 onclick: in a element....但是触摸我必须怎么做?!