The function in a sample of my Jquery code looks like:

```
$(document).on("click",".delete", function(del) {
    var foo='del';
    connect(foo);
    alert("connected");
});

```

And the "connect" function looks like:

```
function connect(foo){
    var networkState = navigator.network.connection.type;
    if (networkState == Connection.NONE){   
        navigator.notification.alert('There is no connection.','','Error','Ok');    
        foo.preventDefault();
    }
}   

```

What I need is to "connect" function after checking internet connectivity stops executing other functions. In this case, function "del" before executing alert. 

With this code I get an error message "Uncaught ReferenceError: del is not defined at file..." What will be the right solution for this?