我的jQuery代码样本中的功能是这样的:的Jquery的preventDefault
$(document).on("click",".delete", function(del) {
var foo='del';
connect(foo);
alert("connected");
});
与“连接”功能看起来像:
function connect(foo){
var networkState = navigator.network.connection.type;
if (networkState == Connection.NONE){
navigator.notification.alert('There is no connection.','','Error','Ok');
foo.preventDefault();
}
}
我需要的是“连接“检查互联网连接后功能停止执行其他功能。在这种情况下,在执行警报之前,功能“del”。
通过此代码,我收到一条错误消息“Uncaught ReferenceError:del未在文件中定义...”对此,什么才是正确的解决方案?
你能否详细说明你的问题? – 2014-09-04 16:14:13
你是否包含phonegap插件? navigator.network.connection.type是一个phonegap功能 – 2014-09-04 16:23:46