jquery check field with confirm
<p>Here is my snippet jquery code. Pratically i would check if field are empty on submit form, then if the username exist show confirm dialog.</p>

<pre><code>&lt;script type="text/javascript"&gt;
jQuery(function(){ 

    $("#form").submit(function(){
        var isFormValid = true;
        if ($.trim($("#telephone").val()).length == 0){
            isFormValid = false;
        alert("Empty telephone!");
        }
    elseif(check_field() == 1){
            if(confirm('Delete?')){
        isFormValid = true;
    }else{
        isFormValid = false;
    }
        return isFormValid;
}); 

function check_field(){  
    var field = $('#field').val();  
    $.post("check_field.php", { field: field }, function(result){ 
        //if the result is 1  
        if(result == 1){  
            return 1;  
        }else{   
            return 0;  

        }  
    });
} 

 }); 
 &lt;/script&gt;
</code></pre>
