how to know if ajax is complete in jquery?

admin

Administrator
Staff member
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.

Code:
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.