我正在使用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:在element....but中触摸,我应该怎么做?!
发布于 2014-04-22 22:22:46
您是否尝试过将preventDefault()作为匿名函数中的第一个语句?您需要将event作为参数传递:
$(document).on("longTap", ".chatOp a[rel]", function(event){
event.preventDefault();
...https://stackoverflow.com/questions/23222057
复制相似问题