• Resolved keytoe

    (@keytoe)


    Hi,

    I have succesfully updated the success message after submitting contact form 7 on my wordpress site.

    However, I would like to be able to display the e-mail address in the succes message. Is this possible and if so, how can I do that?

    I need the e-mail adres for a tracking pixel which I’m implementing. The img is correctly shown right now, but I’m missing the e-mail address:

    on_sent_ok: “var div = document.getElementsByClassName(‘wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok’)[0].innerHTML = ‘<img src=”https://tl.tradetracker.net/?cid=10978&pid=16524&tid=datumplaatsen&eml=&lt;?php echo $_POST[‘your-email’]; ?>&descrMerchant=viaofferteform&descrAffiliate=viaofferteform” alt=”” width=”1″ height=”1″ border”0″ />'”

    https://www.ads-software.com/extend/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
  • Thread Starter keytoe

    (@keytoe)

    Ok, I managed to solve this in the following way.

    You can store the e-mail address in the success message through the back-end with [email].

    Then you are able to access the e-mail through JSON, with the following command:

    var message = data.message;

    If you put this in the on_sent_ok function, you get the full success message. I have put a : in the success message, so that I could split the variable on this sign and put it in the e-mail variable.

    The code to get the tracking pixel I was looking for is shown below. I hope it helps someone.

    on_sent_ok: “var email = data.message.split(‘:’);email = $.trim(email[1]);var now = new Date();now = now. getTime();var div = document.getElementsByClassName(‘wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok’)[0].innerHTML = ‘<img src=”https://tl.tradetracker.net/?cid=10978&pid=16524&tid=’+now+’&eml=’+email+’&descrMerchant=viacontactform&descrAffiliate=viacontactform&#8221; alt=”” width=”1″ height=”1″ border”0″ />'”

Viewing 1 replies (of 1 total)
  • The topic ‘Get email form form on_sent_ok’ is closed to new replies.