如何知道ajax在jquery中是否完整?

There is a generated form from contact form 7 in wordpress. I would like to know if this is the right way of coding in getting the output messages from contact form after it submit and return the messages (either success or not). This code work but it double send the ajax form.

ajaxArgs = {
   url: 'http://sample.net/',
        success: function () {
            var a= $(".wpcf7-response-output").html();
          console.log(a);
        }
    };
$(".wpcf7-form").bind('submit', function() {
  jQuery.ajax(ajaxArgs);
});

if you submit the form from contact form 7. it works in ajax way and I want to get the error or success message after it complete the ajax. I need your advice guys if this is good enough or please if you have a code that makes it better to use.

$.ajax({
    type : "POST",
    url : "${pageContext.request.contextPath}/yourUrl",
    data : {
        key1 : "value1" ,
        key2 : "value2"
    },
    async : true, // if you want wait until ajax done, you should set "async" false
    complete : function(){
        console.log("[JQUERY AJAX COMPLETE]");
    }
    success : function(){
        console.log("success");
    }, 
    error : function () {
        console.log("fail");
    }
});

You can know ajax complete at "complete"

You can use just like this:

$(document).ajaxComplete(function() {
  $(".success").append("Complete");
});

use success and error function fo that

$.ajax({                    
    type: "POST",  
    url: "example.php",
    success: function(){  
       //do some stuff here 
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) { 
        alert("Status: " + textStatus); alert("Error: " + errorThrown); 
    }       
}); 

This code work but it double send the ajax form.

I am not fully able to understand what you are trying to say. But if you want only to submit the form only once you can use preventDefault while binding as below

$(".wpcf7-form").bind('submit', function(e) {
    e.preventDefault();
    jQuery.ajax(ajaxArgs);
});

If this is not what you need, please explain the problem a bit more clearly.

Update: Assuming you are on the same page i.e sample.net is not a third party URL

$(document).ajaxComplete(function() {
    var a= $(".wpcf7-response-output").html();
    console.log(a);
});