Contact Form 7 Wordpress AJAX POST send form data to another action

Viewed 25

I'm using Contact Form 7 Wordpress I'm trying to get form data and send it to another action using AJAX with this code:

<label> Seu nomeeeeee
    [text* your-name id:your-name] </label>

<label> Seu e-mail
    [email* your-email id:your-email ] </label>

<label> Sua mensagem (opcional)
    [textarea your-message id:your-message] </label>

[submit "Enviar"]

<script>
      document.addEventListener( 'wpcf7mailsent', function( event ) {

        var formData = {
                    _clientID: "534000113",
                    _deExternalKey: "0E44E3C0-5984-464A-8E0D-FBBD11837E58",
                    _action: "add",
                    _returnXML: "0",
                    _successURL: "https://example.com/Success",
                    _errorURL: "https://example.com/Failed",
                    nome: $("#your-name").val(),
                    email: $("#your-email").val(),
                    msg: $("#your-message").val(),
                    };

                    $.ajax({
                    type: "POST",
                    url: "http://cl.s12.exct.net/DEManager.aspx",
                    data: formData,
                    dataType: "application/x-www-form-urlencoded",
                    encode: true,
                    }).done(function (data) {
                    console.log(data);
                    });

 
});
</script>

But it's not sending the data. Any idea why?

0 Answers
Related